Home » SQL & PL/SQL » SQL & PL/SQL » how do form this string? (oracle 10g)
how do form this string? [message #282893] Sat, 24 November 2007 14:29 Go to next message
futi
Messages: 22
Registered: November 2007
Junior Member
hi.. i am newbie for oracle. I have an easy question.

I will create a dynamic sql.
Such as:

vName:='MYDIR';
path:='C:\ORACLE\';

sqlStr:='CREATE OR REPLACE DIRECTORY ' ||vName|| ' AS ' ||path||;

so the output of string must same :

CREATE OR REPLACE DIRECTORY MYDIR AS 'C:\ORACLE\';

the ' character must placed in string. How can i do this? With q'?

then, i must run this sql string. But how?
thanx

Re: how do form this string? [message #282895 is a reply to message #282893] Sat, 24 November 2007 16:17 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Research EXECUTE IMMEDIATE.
Re: how do form this string? [message #282899 is a reply to message #282893] Sat, 24 November 2007 20:58 Go to previous message
flyboy
Messages: 1903
Registered: November 2006
Senior Member
When are you in doubt, you can often clear it by reading the documentation, found eg. online on http://tahiti.oracle.com.

SQL Reference
Chapter 2 Basic Elements of Oracle SQL
Literals
Text Literals

You can use q' to specify alternative quoting delimiter, however I still prefer doubling '.
Previous Topic: diffrence between both query
Next Topic: Caching static data
Goto Forum:
  


Current Time: Tue Feb 11 13:38:01 CST 2025