Quantcast
Channel: SCN : Unanswered Discussions - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 4343

Invalid column name; mismatched column in set (UNION ALL)

$
0
0

I saw the Jody's proposed solution in this thread: In Hana SQL Script, can I insert records into an already existing table variable?   which seems great (which it probably is) and now I am trying to do the same, but it does not seem to work as I hoped.

 

PROCEDURE temp (IN a; OUT b)

...

 

DECLARE cond ...

...

 

CALL proc_demo(c);  -- c is returned (OUT) from proc_demo and contains columns 'id' & 'ref'

 

b = SELECT id AS field1 FROM :c WHERE ref = cond

      UNION ALL

      SELECT * FROM :a WHERE ref = cond;

 

Note: 'a' is based on an ABAP dictionary table and contains no column 'id', but column 'field1' among others.

 

The syntax error is: "Invalid column name; mismatched column in set (UNION ALL)"

 

Just for testing I also tried (which gives the same error):

b = SELECT field1 AS field1 FROM :a WHERE ref = cond

      UNION ALL

      SELECT * FROM :b WHERE ref = cond;

 

 

I would appreciate any help on this. Please note I am new to SQL so pls explain on a basic level


Viewing all articles
Browse latest Browse all 4343

Trending Articles