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.

How can I declare a ref cursor for unknown table?

I write a procedure which will generate the insert statments
for a table (the table name passed as parameter),
in this procedure I use a reference cursor but I have error because I don't know the name of the table before the run time

Expand|Select|Wrap|Line Numbers
  1. CREATE OR REPLACE PROCEDURE GENERATE_INSERT_STAT(V_TABLE_NAME VARCHAR2) AS
  2. DECLARE
  3. V_INSERT VARCHAR2(1000);
  4.  
  5. BEGIN
  6. FOR TAB_CUR IN ( SELECT * 
  7.                  FROM  V_TABLE_NAME 
  8.                  WHERE (...any condition....)
  9.                 )
  10. ....
  11. ...
  12.  
  13.  
  14. END;              
  15.  
Jan 12 '11 #1
1 2661
debasisdas
8,127 Expert 4TB
Try to use SYS_REFCURSOR.
Jan 14 '11 #2

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

Similar topics

2
by: James | last post by:
Can anyone please shed some light on the following... I have a framework that uses dynamically created tables, named using an incremental "attribute set ID", as follows: attrdata_1 attrdata_2...
10
by: scoonie999 | last post by:
I'm having a problem that I can't seem to find any solution for online. I'm using a cursor in a cobol program to fetch some data. I know for a fact that the select should return 2 rows. The...
3
nirmalsingh
by: nirmalsingh | last post by:
i know database name but i couldn't find table names corresponding to the database in query analyzer. help me to solve.....
0
by: David Gray | last post by:
Hi all, SQL server 2000 on Windows 2003. This is in test at the moment whilst I get to grips with replication. I have a publication which contains numerous tables as published articles. I'm...
2
Vasuki Masilamani
by: Vasuki Masilamani | last post by:
Hi, I have a SQL query like this. DECLARE @months table(Month int identity (1,1)) DECLARE @i int set @i = 0 WHILE(@i<12) BEGIN INSERT @months default values SET @i = @i + 1
4
by: invy | last post by:
Hi, I'm experiencing a problem while declaring scroll cursor. I'm using Embeded SQL with C. my code is given below. #ifdef SQLSRVR_RDBMS EXEC SQL DECLARE CUR_DWNLD SCROLL CURSOR FOR SCURS;...
2
by: juan.gautier | last post by:
Hi, I try to construct a SQL code for a view to select a specific data from a table, this query take the value of the filter from a text box in a visual basic 6.0 form. my problem is when i...
1
by: gomzi | last post by:
hi, When i try to delete rows in a table by checking the values in an other table, then i receive this error:- "unknown table 'userid' in multi delete" Here's the query...
0
by: rkandas | last post by:
Order by based on input Select col1, col2, col3 from table 1 order by col1 <ASC/DESC>, col2 <ASC/DESC>, col3 <ASC/DESC> The sort order for col1, col2, col3 are parameters to the program. Can...
3
by: Lennart | last post by:
Any thoughts on the following scenario anyone? During a performance test I discovered that the application asked one specific query extremely often. It turned out that this particular query...
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$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.