Focal Point
Using a stored procedure to select a column from a table.

This topic can be found at:
http://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/420106651

June 19, 2009, 04:00 PM
TomG
Using a stored procedure to select a column from a table.
Hi,

I am trying to do something rather simple but am having problems getting it to work.

I have created a stored procedure that accepts a parameter that will be used to select a column (COLUMNA) from a row
in a table and then return another column's value (COLUMNB) to the calling flow. The problem is that COLUMNB holds
the literal value 'COLUMNB' and not the value of COLUMNB.


SQL
SELECT
COLUMNB
FROM
TABLE
WHERE
COLUMNA = '&PARM1'
END

-SET &&OUTPARM = COLUMNB;
-RUN

-EXIT



I am not sure if the above is the correct way to do this or if I should be using a synonym to hold the input and output
parameters. Any suggestions will be greatly appreciated.

Thank you in advance.

TomG


WebFOCUS 7.6.7
Linux
csv/.txt, pdf, Excel
June 20, 2009, 02:47 PM
Frans
Do you want the database value in &&OUTPARM? Then:

TABLE FILE ...
PRINT COLUMNB
FROM
WHERE COLUMNA = '&PARM1'
ON TABLE SAVE
END
-RUN
-READ SAVE &&OUTPARM.A20
-TYPE &&OUTPARM

-EXIT


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
June 22, 2009, 08:49 AM
TomG
Hi Frans,

Your solution is exactly what I was looking for. Thank you for your help on this.

Tom


WebFOCUS 7.6.7
Linux
csv/.txt, pdf, Excel