Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Referencing resultset field in procedure

$
0
0

Hi folks,

 

I have a procedure that has a step where it performs a simple SQL to return a single value from a table.  In this case returning a simple timestamp field in nvarchar format;

 

myStamp = select theTime from MYSCHEMA.TABLE where condition = 'x'

 

If I debug my procedure I can see my variable myStamp as a table type and I can right click on the variable to see the results of the table.  The table contains 1 row with the value '20140508133257'.

 

But now I want to reference this value later on inside the same procedure however I can't figure out the syntax.  I tried this for example;

 

searchStamp NVARCHAR(45) := '';

myStamp = select theTime from MYSCHEMA.TABLE where condition = 'x';

searchStamp = myStamp.theTime;

 

How can I reference the single field in the single row of my resultset so i can use it further on in my procedure?  If I were looping through a cursor I would do this with something like current_row.theTime but in this case I'm avoiding a cursor.

 

Thanks!

-Patrick


Viewing all articles
Browse latest Browse all 8695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>