on 09-11-2019 8:21 AM
in oracle sql I can use 1=1 if I'm using a optional condition.what's the same syntax in SAP SQL? I tried
SELECT * FROM spfli where 1 = 1 INTO TABLE @gt_spfli
and nothing returned. I'm using this SQL in a JCO to query data from SAP.
What makes you think 1=1 would not work in Hana? It does -- in fact, you can just as well use 2=2 or 0=0 (or 2 = 1+1 if you're adventurous). Or, as already noted, avoid the predicate completely.
Since the specific Hana SQL dialect variation was not mentioned, let me just add for completeness two examples:
-- SAP Hana SQLScript:
DO BEGIN
my_tabvar = SELECT * FROM MyTable WHERE 1 = 1;
SELECT * FROM :my_tabvar;
END;
-- SAP Hana SQL:
CREATE TABLE My_New_Table AS (SELECT * FROM MyTable WHERE 2 = 2);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If 1=1 means, that every record should be returned then just don't use any WHERE condition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.