views:

1937

answers:

4

I need to make some changes to an old Oracle stored procedure on an obsolete box that is being kept around to run an old legacy process. The only tool I can connect to the db with is SQL*Plus. How do I load a stored proc into memory for editing in SQL*Plus?

The tutorials I've found on-line don't exlain how that's done. :-(

+4  A: 

It would be a lot easier to download the trial version of TOAD

scratch that previous suggestion, I just tried out the Oracle SQL Developer link suggested and it works peachy fine for editing procs.

for SQLPlus you pretty much need to display the contents of the stored proc, and spool it to a file (as suggested by DCookie :-)) :

sqlplus> spool myprocname.sql;
sqlplus> select text from all_source where name = 'MYPROCNAME' and type = 'PROCEDURE' order by line;
sqlplus> quit;

then edit the local SQL file in a decent editor.

Then use SQLPlus to run the SQL file to re-build the proc for testing.

>sqlplus username/password@tnsnamesentry @myproc.sql

In short, a massive pain in the keester. :-)

Ron

Ron Savage
+1, but you can spool your output to a file and at least avoid the cut/paste pain :-)
DCookie
Good point, I added it in. :-)
Ron Savage
A: 

Can you not download and install Oracle SQL Developer? It's free.

For Unix, there's TOra, (open source)

DCookie
Unix box, i'm connecting locally from an hpux login. There is no TNS to the db so I can only connect locally...
Jeff
How about tora? Open source: http://tora.sourceforge.net ... otherwise, you're stuck spooling your source to a file and using an editor on it.
DCookie
A: 

If you can connect to the db using SQL*Plus, you should be able to connect using a SQL IDE. That said, you cannot open a proc for edit in SQL*Plus, but you can compile one. You can copy your updated proc into the command prompt (line by line if necessary) and compile it.

If you need to access the current source in the manual fashion, you can query the USER_SOURCE table.

I strongly suggest, however, looking into connecting to the DB with an IDE.

akf
A: 

The box is HPUX with no TNS listener running which pretty much wipes out the entire fleet of dev tools. However, the DBA was able to connect using an admin tool called OEM and make the necissary changes. Thanks all for your suggestions.

Jeff
It's kind of embarrassing to have been out of *nix so long that my automatic assumption is that folks have Windows at their disposal...
DCookie