Home » SQL & PL/SQL » SQL & PL/SQL » Compile an object by oracle command for first time (Oracle 11g, windows)
Compile an object by oracle command for first time [message #648806] Fri, 04 March 2016 04:25 Go to next message
Vijay55
Messages: 16
Registered: October 2015
Junior Member
Dear All,

I would like know command for compiling objects when we creating for first time. (not by SQL plus or SQL developer compile options).

For example,

we can use below code to compile already existing objects in database.

ALTER PROCEDURE my_procedure COMPILE;
ALTER FUNCTION my_function COMPILE;


Here my_procedure/my_function is proc/function which is there already in database. But i would need a command to compile such objects when creating for first time itself by passing actual code as clob/varchar.


Thanks,
Vijay
Re: Compile an object by oracle command for first time [message #648833 is a reply to message #648806] Fri, 04 March 2016 06:16 Go to previous messageGo to next message
EdStevens
Messages: 1376
Registered: September 2013
Senior Member
An object is compiled "for the first time" when you create it. You say that your procs, etc, are already there. So what is it you are trying to achieve?

What business problem are you really trying to solve?
Re: Compile an object by oracle command for first time [message #648835 is a reply to message #648833] Fri, 04 March 2016 06:26 Go to previous messageGo to next message
Vijay55
Messages: 16
Registered: October 2015
Junior Member
Hi Stevens,

Thank you for reply.

I want to compile an object by oracle command., means

we can create procedure by 'create or replace procedure proc_name() is... begin.... end;' statement. After writing this statement, we will press compile button to compile the procedure.
I want to achieve this by oracle command. Something like

Declare
l_clob clob;
begin
l_clob :='create or replace procedure proc_name() is... begin.... end;'
<Compile command here taking l_clob as input>

end;

Hope you understand now.

Thanks,
Vijay
Re: Compile an object by oracle command for first time [message #648838 is a reply to message #648835] Fri, 04 March 2016 06:51 Go to previous messageGo to next message
John Watson
Messages: 8931
Registered: January 2010
Location: Global Village
Senior Member
I think you are trying to use dynamic SQL. Look up EXECUTE IMMEDIATE. Note that doing DDL like that is usually a Bad Thing.
Re: Compile an object by oracle command for first time [message #648840 is a reply to message #648838] Fri, 04 March 2016 08:18 Go to previous message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
Do you understand how to create objects normally using sqlplus?
I think the compile button in GUIs has confused you as to how it really works
Previous Topic: Response in JSON format
Next Topic: How to use function to extract 1 or 2 digit number from a string
Goto Forum:
  


Current Time: Thu Apr 25 22:50:30 CDT 2024