473,406 Members | 2,849 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,406 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 3503
"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: 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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.