1748032 Members
4584 Online
108757 Solutions
New Discussion юеВ

Batch Job

 
SOLVED
Go to solution
Hein van den Heuvel
Honored Contributor

Re: Batch Job

>>> I don't think Antonio wanted to correct me - it was rather a hint if H P needs to create an SQL command with two consecutive "'"s.

Ditto. And a good reminder/hint it is.
It is not easy to get dcl to write out two single quote with nothing in between. One is free. Two is hard.
You basically have to build the target string with concatenations or multiple arguments.

$ write sys$output "insert into ... values ('A','"+"');"
--->
insert into ... values ('A','');

Sometimes I use a 'QQ' symbol to help:

$ qq= "'"+"'"
$ write sys$output "insert into ... values ('A',",qq,")"
--->
insert into ... values ('A','')

two more hints:
- Sometimes you need a "&" when working with quotes in symbols in order to 'postpone' substitution.

- Instead of generating SQl commands you may want to look in generating data, and using a dataloader tools instead of sql. By writing out the real data you'll drop one level of quoting quotes

fwiw,
Hein.



Antoniov.
Honored Contributor

Re: Batch Job

Jan,
my post is hard to read simply because it's not possible distinguish two single quote by double quote (may be this character font).
Two single quote, in SQL means a empty string and it's used to write an empty not null value.
Hein posted another interesting solution :-)

Antonio Vigliotti
Antonio Maria Vigliotti
Jan van den Ende
Honored Contributor

Re: Batch Job

Antonio,

You're right.
I totally forgot about empty string.
Guess it was just a bit too late when I wrote the previous entry :-(

Cheers.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.