on 03-08-2017 6:23 PM
Why I can't write any import/export sql statement to a file inside a block of if statement?
"input into" output to" causes always syntax error as long as they are residing inside a block of if condition.
What a solution can I have against it? i.e. when I want to import from a text file into a table under a specific conditions (depending on the result of an 'select' statement).
EXAMPLE:
if exists (select COLUMN1 from TABLE1) then
input into TABLE2 from c:\FILE.TXT
end if;
INPUT and OUTPUT are ISQL (Interactive SQL) commands, not SQL statements. As such, they are processed by ISQL. In contrast, a SQL statement block (like your "if exists ... end if;") is processed by the database engine as whole, and that does not support INPUT/OUTPUT.
As alternative for OUTPUT, you can use the UNLOAD/UNLOAD SELECT statements. For INPUT, LOAD TABLE/OpenString() might do the job.
For further advice, you might look in the separate SAP SQL Anywhere Forum for questions dealing with "OUTPUT" and "procedure".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.