473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Sql Dynamically

Hi guys! I need build a store procedure that receive sql dynamically for paging, but i have problems coz the sql dynamically is inner other sql. This is the code:

CREATE OR REPLACE PROCEDURE SA.Paginado1(
NumMin IN NUMBER,
NumMax IN NUMBER,
SqlStr IN VARCHAR2, -- This is the sql passed
Cur IN OUT Omwb_emulation.globalPkg.RCT1)
AS
BEGIN
OPEN Cur FOR SELECT *
FROM
(
SELECT p.*, ROWNUM rnum
FROM (
-- sql dynamically
) p
WHERE ROWNUM <= NumMax
)
WHERE RNUM > NumMin;
END;
/

Thanks in advance!!!!
Jul 3 '07 #1
2 2247
Hi guys! I need build a store procedure that receive sql dynamically for paging, but i have problems coz the sql dynamically is inner other sql. This is the code:

CREATE OR REPLACE PROCEDURE SA.Paginado1(
NumMin IN NUMBER,
NumMax IN NUMBER,
SqlStr IN VARCHAR2, -- This is the sql passed
Cur IN OUT Omwb_emulation.globalPkg.RCT1)
AS
BEGIN
OPEN Cur FOR SELECT *
FROM
(
SELECT p.*, ROWNUM rnum
FROM (
-- sql dynamically
) p
WHERE ROWNUM <= NumMax
)
WHERE RNUM > NumMin;
END;
/

Thanks in advance!!!!


Thanks a lot!!!! I found a solution for this problem!!!
I wrote:

CREATE OR REPLACE PROCEDURE SA.Paginado(
NumMin IN NUMBER,
NumMax IN NUMBER,
SqlStr IN VARCHAR2,
Cur IN OUT Omwb_emulation.globalPkg.RCT1)
AS
BEGIN
EXECUTE IMMEDIATE 'drop table sa.v_temp';
EXECUTE IMMEDIATE 'CREATE TABLE sa.v_temp AS '||sqlstr;
OPEN Cur
FOR SELECT *
FROM(
SELECT p.*, ROWNUM rnum
FROM (
v_temp
) p
WHERE ROWNUM <= NumMax
)
WHERE RNUM > NumMin;
END;
/


Explanation: Just create a temp table that receive the sql dynamically and I use this table to obtain the rownums tops.
Thanks a lot!!!!
Jul 3 '07 #2
debasisdas
8,127 Expert 4TB
Moved to Oracle forum.
Jul 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Tim T | last post by:
Hi, I have the need to use dynamically loaded user controls in a webform page. I have the controls loading dynamically, and that part works fine. this is the code used in a webform to dynamically...
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
1
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a...
7
by: pmclinn | last post by:
I was wondering if it is possible to dynamically create a structure. Something like this: public sub main sql = "Select Col1, Col2 from Table a" dim al as new arraylist al =...
2
by: Pete Moss | last post by:
During a postback event, I am having trouble retrieving the state of a CheckBox Control that I am dynamically adding to a DataGrid Control using ASP.NET 1.1. I have no trouble adding the...
9
by: netasp | last post by:
hi all, how can I populate one aspx form when page is loading based on page ID? for example: loading page A (to search for VB code) would display labels and texboxes, dropdown lists all related...
4
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.