Sign in or 

| Language | Precompiler Name |
| C/C++ | Pro*C |
| COBOL | Pro*COBOL |
| FORTRAN | Pro*FORTRAN |
| PL/I | Pro*PL/1 |
|
jonah.harris |
Latest page update: made by jonah.harris
, Nov 27 2007, 7:33 AM EST
(about this update
About This Update
view changes - complete history) |
|
Keyword tags:
c
cobol
embedded sql
precompiler
pro*c
pro*cobol
pro*fortran
pro*pl/1
sql
More Info: links to this page
|
| Started By | Thread Subject | Replies | Last Post | ||
|---|---|---|---|---|---|
| anup13 | Rownum in Pro*c and | 0 | Mar 17 2009, 1:10 AM EDT by anup13 | ||
|
Thread started: Mar 17 2009, 1:10 AM EDT
Watch
hi,
In My pro*c code when I am executing Following code its giving perfect results. EXEC SQL DECLARE count_cursor CURSOR FOR SELECT * FROM ( SELECT Trade_Count, Day_Trade_Count FROM Margin_Balance WHERE (Account_Id = :accountid) AND (Account_Reg_Class_Id = :regclassid) AND (Calculation_Date <= to_date (:calculationdate, 'YYYY-MM-DD')) AND (Balance_Type = 'Local') AND (Request_Type = 'Post') ORDER BY Calculation_Date Desc ) WHERE rownum < 5; it selects all rows which is right, but when i replace '5' with variable, its only select first row, can any one tell me why? what is the problem, and what is possible solution EXEC SQL BEGIN DECLARE SECTION; int DayTradeBusinessDates; EXEC SQL END DECLARE SECTION; DayTradeBusinessDates = 5; EXEC SQL DECLARE count_cursor CURSOR FOR SELECT * FROM ( SELECT Trade_Count, Day_Trade_Count FROM Margin_Balance WHERE (Account_Id = :accountid) AND (Account_Reg_Class_Id = :regclassid) AND (Calculation_Date <= to_date (:calculationdate, 'YYYY-MM-DD')) AND (Balance_Type = 'Local') AND (Request_Type = 'Post') ORDER BY Calculation_Date Desc ) WHERE rownum < :DayTradeBusinessDates; this Query returns only one row, that is first row of inner query. |
|||||