Home » SQL & PL/SQL » SQL & PL/SQL » Using & character in PL/SQL
Using & character in PL/SQL [message #209570] Fri, 15 December 2006 10:28 Go to next message
ying
Messages: 143
Registered: May 2002
Senior Member
Hi,

I have a sql file which run a certain query. In my PL/SQL I have a varchar2 variable which use to store text a below:

user_html := user_html || 'You may click <a href="http://www.myhost.com/padoc/mysystem/viewpreobs.jsp?p_id='||trng_rec.empnumber||'&e_id='||trng_rec.event_id||'">here</a> to view your employee's details<br><br>';

I have problem which this statement, as below:
1.) When I run the file in SQL plus, it prompt me to enter the e_id

2.) When viewing, the "employee's" become employee?s

Pls advise....

Ying
Re: Using & character in PL/SQL [message #209572 is a reply to message #209570] Fri, 15 December 2006 10:32 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
In SQL*Plus use:

set define off
Re: Using & character in PL/SQL [message #209606 is a reply to message #209572] Fri, 15 December 2006 19:45 Go to previous messageGo to next message
ying
Messages: 143
Registered: May 2002
Senior Member
ok...thank you. Manage to manually exec via sql plus. Well, due to we are required schedule and cron the .sql to exec in certain date and time...so, do I need to specify the "Set define off" in my .sql file???

By the way, How do I use "'" in the PL/SQL as I treat the "'" (quote string) as a terminated string.

pls advise.....

Ying
Re: Using & character in PL/SQL [message #209617 is a reply to message #209606] Fri, 15 December 2006 22:23 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
If you intend on running the script in SQL*Plus, then you'll need to specify set define off at the top of your script. To use a single quote, you should just use two single quotes ''. If you are using 10g, you can use the alternative quoting mechanism to accommodate the single quote.
Previous Topic: Implementing 1 to many mandatory relatioship
Next Topic: sqlca
Goto Forum:
  


Current Time: Tue Dec 06 12:37:41 CST 2016

Total time taken to generate the page: 0.10692 seconds