473,395 Members | 1,938 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,395 software developers and data experts.

Cursor parameters - problems with 'FROM [inTablename]' statement

I'd like to declare a cursor, which accepts parameters also for the
"FROM" tablename-clause, like:

CURSOR cFielddef(pfromTable IN ?????, pTableName IN VARCHAR2) IS
SELECT column_name, data_type, data_length, nullable FROM pfromTable
WHERE table_name = UPPER(pTableName);

Is it possible at all, and what type do I have to decalre in place of
the questionsmarks? Any other solution?

Thanks für your help,

Sugus
Jul 19 '05 #1
2 3502
"Sugus" <kr**@europ.de> wrote in message
news:76**************************@posting.google.c om...
I'd like to declare a cursor, which accepts parameters also for the
"FROM" tablename-clause, like:

CURSOR cFielddef(pfromTable IN ?????, pTableName IN VARCHAR2) IS
SELECT column_name, data_type, data_length, nullable FROM pfromTable
WHERE table_name = UPPER(pTableName);

Is it possible at all, and what type do I have to decalre in place of
the questionsmarks? Any other solution?

Thanks für your help,

Sugus

What do you want the query to do? You can't do it that way because Oracle
is trying to compile it and make sure the columns exist etc. If it does not
know the tablename then how could it? You would have to use dynamic sql
which may cause scalability problems.
Jim
Jul 19 '05 #2

"Sugus" <kr**@europ.de> wrote in message
news:76**************************@posting.google.c om...
I'd like to declare a cursor, which accepts parameters also for the
"FROM" tablename-clause, like:

CURSOR cFielddef(pfromTable IN ?????, pTableName IN VARCHAR2) IS
SELECT column_name, data_type, data_length, nullable FROM pfromTable
WHERE table_name = UPPER(pTableName);

Is it possible at all, and what type do I have to decalre in place of
the questionsmarks? Any other solution?

Thanks für your help,

Sugus


you would have to use dynamic SQL for this. The parameter would then simply
be a VARCHAR2 type, i.e., string.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Matthew Houseman | last post by:
All, I've created a synonym that points to a package over a database link like so: CREATE SYNONYM API_MYLINK FOR USER.CSAPI_V2@INSTANCE.DOMAIN.COM I've granted execute like so: grant execute...
7
by: Philip Mette | last post by:
Does anyone have any good references they could recommend on Cursor based SQL writing? I have to create SQL that can loop though records simular to VB loops and I have been told that this is the...
10
by: Neil | last post by:
I need to get two values from a complex SQL statement which returns a single record and use those two values to update a single record in a table. In order to assign those two values to variables...
7
by: William Gill | last post by:
I have been trying to pass parameters as indicated in the api. when I use: sql= 'select * from %s where cusid = %s ' % name,recID) Cursor.execute(sql) it works fine, but when I try : sql=...
12
by: pamelafluente | last post by:
Hi guys, In the past I have used several time optional parameters in my function. But Now I am more inclined to think that they are more dangerous than useful, and probably better to be...
4
by: Sierra | last post by:
Problem: Database connections are not being reused properly. SP_WHO2 shows upwards of 200 connections being created per page request. Most connections exist for 60 seconds then close without...
2
by: Bill_DBA | last post by:
I have the following stored procedure that is called from the source of a transformation in a DTS package. The first parameter turns on PRINT debug messages. The second, when equals 1, turns on the...
1
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
Can anyone offer pointers to articles/examples of passing a Ref Cursor ***IN*** to an Oracle stored procedure. I find tons of examples for getting a ref cursor OUT of a stored procedure. I'm using...
2
by: Sugus | last post by:
I'd like to declare a cursor, which accepts parameters also for the "FROM" tablename-clause, like: CURSOR cFielddef(pfromTable IN ?????, pTableName IN VARCHAR2) IS SELECT column_name, data_type,...
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: 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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.