Embedded SQL PrecompilersThis is a featured page

An Embedded SQL Precompiler is a development tool which enables developers to embed SQL statements within the source code of a high-level host program written in C, C++, COBOL, FORTRAN, or PL/1. When the source code is passed through the precompiler, all embedded SQL statements are translated into Oracle runtime library calls which can then be compiled using a standard compiler.

Precompiler Host Language Support


Oracle supports precompilers for embedding SQL in the following languages:

Language
Precompiler Name
C/C++Pro*C
COBOLPro*COBOL
FORTRANPro*FORTRAN
PL/IPro*PL/1

In addition the the precompilers, Oracle provides SQL*Module for Ada; a library for Ada developers which builds parameterized procedures that encapsulate SQL statements.

Precompiler Misconceptions


On several mailing lists and forums, many people think that the Oracle Precompilers generate code for OCI; an inaccurate statement. Instead, the Oracle Precompilers translate embedded SQL into calls to the SQL Library (SQLLIB).



jonah.harris
jonah.harris
Latest page update: made by jonah.harris , Nov 27 2007, 7:33 AM EST (about this update About This Update jonah.harris Added borders to the table. - jonah.harris


view changes

- complete history)
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.
1  out of 1 found this valuable. Do you?    
Keyword tags: pro*c rownum
Showing 1 of 1 threads for this page

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)