How do I remove a new row, that added by pressing CTRL + I but it not committed yet, in SQLDeveloper - oracle-sqldeveloper

In SQLDeveloper, I have added a row in a table by pressing CTRL + I but I have not committed it, now I want to remove it. When I select that row and press CTRL D, nothing happens.

For me, it turns red when I press CTRL+D.
However, as you didn't commit yet, just press F12 which performs rollback and that newly inserted row will disappear.

I 'fat finger' 5 or 6 times, and accidentally 'create new rows' in my TABLE.
I haven't actually...I just have some 'local,' to my machine changes to the table, that I could 'COMMIT.'
But I don't want to COMMIT, I want to...UNDO those mistakes.
So I could...select the rows and hit the DELETE button, but that's extra work, not required.
If you have made NO OTHER CHANGES to your table, you could simply hit the ROLLBACK button.
See the log below 'Local changes cleared' - but once I hit 'Rollback' ANY uncommitted transactions or transactions not posted to the database, will be undone.

Related

User opens one screen in two browser tabs and press update button within milliseconds

I am running into one issue. Any help would be appreciated.
I am using PostgreSQL as back end.
The issue is: User opens one screen in two tabs and press update button within a second.
Example - table fields - id - is_posted
I have a flag on the table which I am setting it to true - is_posted = true and after setting this flag to true I have a trigger which inserts few records in other tables. If is_posted = true then I am not allowing the user to update that record again.
If a user clicks 'Update' button in one tab and after 1 - 2 seconds clicks 'Update' button on other tab then I get updated value and easily throw validation message that "Record already updated".
But if a user follows the same process but within milliseconds, then I do not get the updated data and record get updated twice. And it is creating multiple records in other tables which is leading to create bad data.
Kindly suggest.
Thanks,

SQL Developer - cannot see some of the rows at the end?

I know that I have about 180 rows in my table. But, SQL developer lets me scroll down and see only 100. The scroll tab/field shows that there are more than 100. But, when i pull the scroll bar down, i don't see the remaining rows. After that, when i release the mouse button, the scroll bar returns to the middle of the scroll field.
This never happened before. Could it be a bug ?
Click on any field of the rows that were returned, then hit CTRL+END to retrieve the reset of the rows... that is how I have always done it.
EDIT: could also be your preferences
Tools -> Preferences
Expand Database
click on Advanced
update the SQL Array Fetch Value (MAX = 500)

Invalid Column Name When Open To Edit A Table

I'm running SQL 2008 R2. I added 3 columns to an existing table. There was not any problem. Then I opened the table to edit with right click ("edit top 200 rows"). When I write a value to the new added columns, it says invalid column name. I cleared the cache of Intellisense, but still the same error.
Try refreshing Tables on the ObjectExplorer, just press F5 to refresh and try again. Also you could refresh only the affected table.

How to add a Time dependent trigger in PostgreSQL?

I'm confused and clueless on how to:
Add a trigger to a postgresql db once the db has been set up, i.e. adding a trigger by clicking a hyperlink
Write a trigger function so that it deletes a specific row after a week has passed since the trigger was written.
This is the sequence once events just for clarity
Admin sees entry in db via a php generated html page.
Admin clicks 'approve' hyperlink next to db entry.
This creates a trigger in the db to delete that specific row after 1 week has passed.
I need help with step 3
Would an alternative way of doing this be to have a trigger on the table, so that when a row is inserted a new trigger is created which checks the value of an 'approved' column for that row. When the Admin clicks 'approve' in the html page the word 'yes' is inserted to the 'approved' column for that row. The trigger will detect this and add a new trigger to delete the row after a week?
As you can tell i'm really not sure which way to do it and how to do it so any feedback would be much appreciated. Thanks.
Simple: Store an expiration date for the url in your db, only retrieve currently valid records (you can use a view for this) in your select, and delete expired urls from time to time.
You can't use a trigger though. pgAgent or cron could be used to start a cleanup process though.

How copy data from Excel to a table using Oracle SQL Developer

Is there any alternative way to copy the data from Excel sheet and paste it into a table using Oracle SQL Developer!?
For now I am using (PL/SQL Developer) by writing (for update) at the end of the select statement, Ex:
Select * from ABD
for update
Then paste the columns from Excel to the table...
Regards
Adel
It's not exactly copy and paste but you can import data from Excel using Oracle SQL Developer.
Navigate to the table you want to import the data into and click on the Data tab.
After clicking on the data tab you should notice a drop down that says Actions...
Click Actions... and select the bottom option Import Data...
Then just follow the wizard to select the correct sheet, and columns that you want to import.
EDIT : To view the data tab :
Select the SCHEMA where your table is created.(Choose from the Connections tab on the left pane).
Right click on the SCHEMA and choose SCHEMA BROWSER.
Select your table from the list (by giving your schema).
Now you will see the DATA tab.
Click on Actions and Import Data...
None of these options show up for me. The way to paste data from Excel is as follows:
Add an extra column to the left of your spreadsheet data (if you
don't have row numbers showing in PL/SQL Developer you may not have
to have an extra empty column to the left).
Copy the rows of data from your spreadsheet including the empty
column.
In PL/SQL Developer, open your table in edit mode. You can
right-click the table name in the object browser and select Edit Data
or write your own select statement that includes the rowid and click
the lock icon. Be sure your columns are ordered the same as in your
spreadsheet.
Here's the part that took me forever to figure out: click on the left
side of the first empty row to highlight it. It will not work if you
don't have the first empty row highlighted.
Paste as usual using Ctrl+V or right-click Paste.
I couldn't find this info anywhere when I needed it, so I wanted to be sure to post it.
You may directly right-click on the table name - that also shows the "Import Data.." option.Then you can follow few simple steps & succeed.
Do anyone know how to import a new table with data from excel?
Click on "Tables" in "Connections" window, choose "Import data ...", follow the wizard and you will be asked for name for new table.
For PLSQL version 9.0.0.1601
From the context menu of the Table, choose "Edit Data"
Insert or edit the data
Post change