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.

Write A Comment