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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL from SQL insert statements 1

Status
Not open for further replies.

mcowen

Programmer
Oct 21, 2001
134
GB
Hi,

I am trying to create update statements using SQL from SQL. I can concatinate into the spooled file every character apart from the much needed '. So the spooled statements look like:

update table_name SET (col_name) = "value";

Is there any way of specifying that the output be a ' as opposed to the "?

Many thanks
Matt
 
Use two single quotes. Here is an example from a script I wrote to generate SQL:
Code:
SET  feedback OFF
SET echo OFF
SET pagesize 0
SET linesize 100
spool rolequery.SQL
SELECT 'SELECT USER_ID'
FROM dual;
SELECT ', DECODE (SUM (DECODE (ROLE, ''' || ROLE || ''',1)), NULL, NULL, ''     Y     '') ' || ROLE
FROM USER_ROLE;
SELECT 'FROM USER_ROLE GROUP BY USER_ID ORDER BY USER_ID;'
FROM dual;

spool OFF
SET feedback ON
SET pagesize 80
START rolequery
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top