I come from a heavy T-SQL background, have been familiarizing myself with IBM Netezza appliance for a customer. I have played with the Netezza emulator 7.1 on Windows, ran DDL, DML, Control, and Transaction statements. Also, I signed up for a trial DashDB on Bluemix cloud.
ISSUE:
I am facing hurdles with the syntax on both Aginity workbench for DashDB and also the RunSQL on Bluemix
These prevent me from writing more complex SQL beyond simple DDL, DML statements. I am quite frustrated about this.
- variable declarations
T-SQL:
DECLARE @I AS INTEGER;
I tried this
DECLARE VARIABLE i INTEGER ;
ERROR [42601] [IBM][DB2/LINUXX8664] SQL0104N An unexpected token "INTEGER" was found following "DECLARE i ". Expected tokens may include: "END-OF-STATEMENT".
DECLARE i AS INTEGER;
ERROR [42601] [IBM][DB2/LINUXX8664] SQL0104N An unexpected token "INTEGER" was found following "DECLARE i AS ". Expected tokens may include: "END-OF-STATEMENT".
DECLARE i INTEGER;
ERROR [42601] [IBM][DB2/LINUXX8664] SQL0104N An unexpected token "INTEGER" was found following "DECLARE i ". Expected tokens may include: "END-OF-STATEMENT".
none of these work...I am simply baffled!
- this very simple stored procedure sample from does not compile for me
Code:
CREATEPROCEDURE DASH6441.FOO (IN ORDER_DETAIL_CODE_IN VARCHAR(16), IN SALES_STAFF_CODE_IN INTEGER)
LANGUAGESQL
BEGIN
SELECT*FROM DASH6441.EMP;
END;
Error:
ERROR [42601] [IBM][DB2/LINUXX8664] SQL0104N An unexpected token "EMP" was found following "ECT * FROM DASH6441.". Expected tokens may include: "END".
Questions:
is there anything I am missing?
like T-SQL is there any structure for a SQL script, or preliminary directives (e.g.
USING <db_name>in T-SQL) the compiler is expecting? I doubt it, but just askingIf you can share a skeleton of a variable declaration, stored procedure, or generic script with all those elements, which you know compiles successfully for you? Maybe I can inspire myself from that
I am facing a showstopper right now with this syntax issue.