Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PL/SQL: Syntax for EXECUTE IMMEDIATE Statement

Status
Not open for further replies.

Jeronimo

Programmer
Aug 2, 2001
12
US
Hi,
I want to create a directory at runtime. This is my PL/SQL code:

1 DECLARE
2 h_var VARCHAR2(20) := 'C:\images\';
3 BEGIN
4 -- EXECUTE IMMEDIATE 'CREATE directory "image_dir" as ''C:\images\'' ';
5 EXECUTE IMMEDIATE 'CREATE directory "image_dir" as || help ';
6 END;
7 /

I get the following error message:
ERROR at line 1:
ORA-01780: string literal required
ORA-06512: at line 5

Does anybody know how the correct syntax is? When I comment out line 5 instead of line 4, it works fine, but I need to have a variable for the directory name...
Many thanks,
Jeron
 
Ummm... Did you mean to call your variable h_var on line 2 and then try to append help on line 5?

Hope that is it...
[sig]<p>Terry M. Hoey<br><a href=mailto:th3856@txmail.sbc.com>th3856@txmail.sbc.com</a><br><a href= > </a><br>Ever notice that by the time that you realize that you ran a truncate script on the wrong instance, it is too late to stop it?[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top