471,092 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,092 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 3384
"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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Matthew Houseman | last post: by
7 posts views Thread by Philip Mette | last post: by
10 posts views Thread by Neil | last post: by
7 posts views Thread by William Gill | last post: by
1 post views Thread by =?Utf-8?B?cmFuZHkxMjAw?= | last post: by

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.