Quantcast
Channel: SCN : Discussion List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 5653

Problem binding variable to query in procedure

$
0
0

Hi folks,

 

I'm having an issue binding a variable to a query.  For example the following works in my procedure;

 

DECLARE V_PLANT NVARCHAR(4) := 'ACME';

tempVar = select field1 from myView where Plant = :V_PLANT;

 

When I debug my procedure I can see the variable V_PLANT = 'ACME' and tempVar contains 1 single value (field1) record.

 

Now, alternatively, if I try passing my variable like this it is not working (get error: no data found);

 

DECLARE V_PLANT NVARCHAR(4) := 'ACME';

ABCVariable NVARCHAR(45) := '';

select field1 into ABCVariable from myView where Plant = :V_PLANT;

 

However if I hard code the plant variable as a literal string like this I indeed get data;

DECLARE V_PLANT NVARCHAR(4) := 'ACME';

ABCVariable NVARCHAR(45) := '';

select field1 into newVariable from myView where Plant = 'ACME';

 

Result is I have a value of 'ACME' in ABCVariable.  It seems when I'm using SELECT INTO syntax I can no longer use variables in the where condition.

 

Any suggestions?

Thanks,

-Patrick


Viewing all articles
Browse latest Browse all 5653

Trending Articles