Fun fact, I have to think VERY hard before typing ‘peak’ vs ‘peek.’

Today I want to highlight some of the language server protocol support build into our VS Code extension for the SQL and PL/Language, specifically –

A peak is something you climb, or admire from a distance.

Go to Declaration

This one is pretty obvious, you have some Oracle database code (SQL or PL/SQL), and you want to go look at the object being referenced in your code.

The simplest example would be something like –

select * from hr.employees;

So let’s do it –

Yes, we’re going to fix the default column sizing in our data grids in an update, very soon!

Alright, now let’s try something a bit more interesting.

From inside my HR.ADD_JOB_HISTORY() procedure, I want to go look at my JOB_HISTORY table.

Wait, what was that funny looking part in the middle of the ‘Goto?’

My INSERT statement isn’t schema qualified. It just says to

INSERT INTO job_history (empl...

So, when we ask our editor to open JOB_HISTORY, we search for objects called JOB_HISTORY, and if there’s more than one, we give you a list.

This is kind of like a Peek.

We have a list of objects in the database, shown or represented as ‘files,’ and they’re organized on the:

  • connection, HR
  • schema, HR, HRREST, OE
  • object type, TABLE, TABLE, SYNONYM

Click one one, and the full metadata are displayed on the left. But double-click here, and we’ll open the object for you.

I have another table in my HRREST schema and a synonym in the OE schema by this name.

There’s probably a better way to display this metadata to SQL and PL/SQL developer, but for the moment this is what we came up with. I’d love to hear if you’ve seen other extensions find a better way of doing this, or if you have any suggestions!

Peek

You can peek into most things, but the real value of doing a ‘peek’ is for code objects. Awhile back I did an overview of using 23c’s new Multi Language Engine’s support for running native JavaScript in the database.

You can use the js Fetch command to run things like…REST APIs.

What’s that look like?

I think it looks pretty cool!

So I can actually ‘peek’ into the JavaScript behind my program.

Now if I want to get more than a peek, I can still double-click on the item on the right, and open my program.

That’s not the real URL…

For a proper rundown on MLE and JavaScript in the database, I suggest following our friend and colleague, Martin Bach.

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

4 Comments

  1. I have a similar problem. I can go to the declaration from my own SQL code, but if that declaration (stored view) is referencing other views, I only get a limited context menu (“Copy” and “Command Palette”) and I cannot navigate any further.

    • When we show the SQL behind the VIEW, that’s not a code editor, it’s a web view. Click the pencil icon top right to get an editor, then you can keep peeking/goto to your heart’s delight.

  2. nice, thanskf for extention, like its light weight so far, couple observations maybe these are coming down the road:

    I am not able to do peek or declaration sometimes, it says no objects found, yet i am able to do select, desc, info on table.
    i am not able to highlight mutliple rows in vs query result, by selecting first, Shift, last
    , copy column header is missing as well from query table.
    where is filter, i thought was added, but not seeing it
    Is there a way to pin the sqldev extension so it stays in activity bar
    also how to make intellisence display available tables select * from ABCD…
    The font little small/fuzzy in query result compared to sql developer big white tables.
    the connection does not renew itself when i step away and return to re-run the select statement, i have to re-authenticate again, it says: DBTS-05102: The connection session was terminated
    The connection session was terminated, due to error: null
    Error at Line: Column:
    thank u,

    • ‘sometimes’ if you could provide an example, we can get a big filed and fixed

      Shift range selection in grids..coming soon

      Filter, where? You can filter schemas and objects or data in grids…or in SQL history

Write A Comment