ThatJeffSmith

SQL Developer: I’m Looking at a Record, How Do I Edit It?

Liked this? Share it!

You’re doing some data clean-up, or maybe you’re just trying to answer a business question for a user, and you notice the data doesn’t look quite right.

Name that tune...

Name that tune…

You want to click in that ‘(null)’ cell and tell the world that Tyler and Perry composed that song! But, we’re in a query result set, and not a table editor. I’m the ultimate lazy-dev, so what’s the easiest way to get what I want?

Throw In a Little Copy & Paste with some Mouse Magic

Copy the WHERE and ctrl+hover into the table

Copy the WHERE and ctrl+hover into the table

  1. Copy your WHERE clause, minus the actual word ‘WHERE’
  2. Ctrl+Mouse hover over the table or view name in the FROM
  3. This should get you here:

    Every Table and View Editor Has a Filter Control

    Every Table and View Editor Has a Filter Control

    Now paste in your text from where you copied it in the worksheet and hit

    Edit away!

    Edit away!

    But Why Can’t I Just Edit the Data in The Worksheet?

    Suffice to say there are philosophical and technical challenges at play here. We’ve decided to leave the worksheet as a place where you go query and run scripts. Interactive (read+write) grids in the worksheet are not going to happen.

    On the philosophy side of things – the concept of doing a SELECT, getting results back, and then treating those as ‘live’ records for you to update: that doesn’t jive with us. If you want to edit records, then you should go into the table editors. Or write an UPDATE. Or a DELETE.

    And if you want to do this for joined records, make a view.

    But instead of just ‘being stuck’ I hope you find this alternative workflow better than just writing your UPDATEs and DELETEs on your own.

    No, you can’t always get what you want
    No, you can’t always get what you want
    No, you can’t always get what you want
    But if you try sometime, you just might find
    You get what you need
    — Mick Jagger/Keith Richards

    Related Posts Plugin for WordPress, Blogger...
    Liked this? Share it!