Subject | pipe multiline sql into isql |
---|---|
Author | Yves Glodt |
Post date | 2006-01-20T09:37:12Z |
Hi,
I frequently use (and really like) the "pipe sql into" feature of isql, e.g:
echo "update ...;" | isql-fb -user SYSDBA -pass masterke localhost:db
Now I need to update a trigger, that is drop an recreate it, and I tried
to put it as one long line between the quotes, like this:
echo "drop TRIGGER CONFIGURATION_UPDATED; SET TERM ^; CREATE TRIGGER .."
But it fails as it expects the sql to be split into multiple lines...:
Statement failed, SQLCODE = -104
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, char 37
-SET
As I'm on linux, I tried to do it in a little bash script, like e.g.:
#!/bin/bash
sql='
123
123
123
'
echo $sql
But this also outputs like this:
123 123 123
No newlines neither...
How could I work around this?
Best regards,
Yves
p.s.
In my special case, I can not use the -i feature, because I can not rely
on external files. So "isql-fb -user SYSDBA -pass masterke localhost:db
-i bla.sql" is not an option :-(
I frequently use (and really like) the "pipe sql into" feature of isql, e.g:
echo "update ...;" | isql-fb -user SYSDBA -pass masterke localhost:db
Now I need to update a trigger, that is drop an recreate it, and I tried
to put it as one long line between the quotes, like this:
echo "drop TRIGGER CONFIGURATION_UPDATED; SET TERM ^; CREATE TRIGGER .."
But it fails as it expects the sql to be split into multiple lines...:
Statement failed, SQLCODE = -104
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, char 37
-SET
As I'm on linux, I tried to do it in a little bash script, like e.g.:
#!/bin/bash
sql='
123
123
123
'
echo $sql
But this also outputs like this:
123 123 123
No newlines neither...
How could I work around this?
Best regards,
Yves
p.s.
In my special case, I can not use the -i feature, because I can not rely
on external files. So "isql-fb -user SYSDBA -pass masterke localhost:db
-i bla.sql" is not an option :-(