Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Impromptu UDF LAG

Status
Not open for further replies.

RobReynolds

Technical User
Jul 12, 2002
5
US
I have an Impromptu report off an Oracle database that uses direct SQL to retrieve a value from the previous row. Ex this query:
select c1, lag(c1,1) over (order by c1) c2
from table;

will return:
c1 c2
row1
row2 row1
row3 row2

I would like to be able to use an Impromptu user defined function as to avoid the direct SQL. On the orfunct.ini under the database specific function list I've added an entry for
lag=

under the details:
[lag]
label=lag
param=3
return=A
1=DA,DT,NM,CH,IN,TM:A;Expr
2=NM;Expr
3=DA,DT,NM,CH,IN,TM:A;Expr
exp=lag ( ^1 , ^2 ) over ( order by [ , ^3 ] * )
tip=Syntax: UDF Function for previous row
tip1=Enter first expression
tip2=enter offset
tip3=Order by

I've created a cogudfor.sql with:


DECLARE DATABASE FUNCTION LAG( STRING, NUMBER ) OVER (ORDER BY STRING)
RETURNS STRING
FUNCTION NAME LAG;

when I go into Impromptu I don't see the new function 'lag'. Has anyone else tried to do this? Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top