Compile PL/SQL Package and loose 'Create Or Replace" and package schema

I'm using DataGrip 2024.1.3, (Build #DB-241.17011.41, built on May 14, 2024).

I'm working with a remote Oracle database developing PL/SQL packages. Before I compile the package, I always have to make sure that I re-add the bolded text in the package. 'CREATE OR REPLACE PACKAGE BODY SCHEMA_NAME.PACKAGE_NAME AS". 

Is there a way to configure how Datagrip compiles, so it does not remove the replace and schema name you compile? When working in Oracle SQL developer,  I don't have issues with the create or replace on the package declaration (but it does remove the schema name). 

I'm just curious if there is a workaround for this, or just something to live with? 

2
6 comments

Hi Mike,

As far as I know, the ‘Submit’ action does generate the expected syntax:

Alternatively, you can use the “Generate DDL to Query Console” action on the package to view the actual generation script:

1

Hello @..., however if we wanted to compile changes in packages this way, we would not get compilation errors. It just submits and check, if it was compilated successfully. If not, you have no way to see compilation errors.

So I also have to insert the “or replace” keyword, mark whole code and execute it. That gives back “Object has changed in database” warning, so I always have to “Revert local changes”. Or firstly compile via code execute and then submit.. 

If you know some workaround, I would be glad to know it. 

0

Hi Matej,

So I also have to insert the “or replace” keyword, mark whole code and execute it. That gives back “Object has changed in database” warning, so I always have to “Revert local changes”. Or firstly compile via code execute and then submit.

Can you explain your scenario and why you would get a notification of changes if submitting a change to your package when executing CREATE OR REPLACE statement? 

0

Hello, 

I open package body from object browser 

 

 

lets say i wanted to inject some code there, but break the package along the way

 

If I pressed submit, it would be changed in the cached data and compiled in background, but I do not get the error this compilation raised. 

Only way to get to this information is to inject or replace keyword and execute the code (marking it, pressing execute shortcut)

This way i get to the error log: 

 

Realizing my mistake, I fix the code, but I am not sure if more compilation errors won't be raised - therefore I execute the code same way as before - marking the code and executing - if compilation was successfull i do get  banner raised immediately: 

 

 

So I also have to revert local changes to finish this properly (or wait for auto-sync). 

That's the workflow I would be forced to take as of now, if I wished to use database objects. We have our packages in repository as files and we compile from there, not using the object browser at all. 

 

If you have any suggestion to better workflow to change package without having to inject “or replace” keyword, get compilation errors, and also immediately refresh cached data - I am looking forward :) 

 

Thank you,

Matej 

 

0
Hi Matej,

We have acknowledged this issue and filed it on our tracker:

https://youtrack.jetbrains.com/issue/DBE-25469

I couldn't identify any issues with the auto-generated SQL statement when submitting the changes in Object Editor in 2025.3.5. See the ticket above for more details
0

Hello Aleksandr, 

thank you for acknowledging the issue. 

The best solution, as of me, would be to simply propagate compilation errors raised within submit button. 

Thank you!

0

Please sign in to leave a comment.