Thursday, September 25, 2008

Some Functions in Report Builder

To Print in log file

SRW.MESSAGE(1,'String to be printed in log file');

Here first parameter indicates the log file(1).
Second parameter is the string that to be printed in log file.

To Abort from the report

RAISE SRW.program_abort;

Tuesday, September 9, 2008

Use of Analytical Function

Requirement : I need list of items purchased in a month. If a item purchased more than once in a month then i need the recent purchase order number.

Solution :

SELECT *
FROM (SELECT segment1, description, ponumber,
ROW_NUMBER () OVER (PARTITION BY segment1 ORDER BY pocreationdate DESC) mycol
FROM base_table
WHERE TO_CHAR (pocreationdate, 'MM YYYY') = '04 2008')
WHERE mycol = 1