IB - Developer Center    Forums  Hop To Forum Categories  iWay Products    Using a stored procedure to select a column from a table.
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
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
 
Posts: 28 | Registered: June 01, 2009Reply With QuoteReport This Post
Platinum Member
Posted Hide Post
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 7.6.10
Prod: WF 7.6.9
DB: Progress, IBM DB2, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle 9i/10g.
 
Posts: 138 | Location: Europe | Registered: February 05, 2007Reply With QuoteReport This Post
Member
Posted Hide Post
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
 
Posts: 28 | Registered: June 01, 2009Reply With QuoteReport This Post
  Powered by Social Strata  
 

IB - Developer Center    Forums  Hop To Forum Categories  iWay Products    Using a stored procedure to select a column from a table.

Copyright © 1996-2010 Information Builders, leaders in enterprise business intelligence.