Home » SQL & PL/SQL » SQL & PL/SQL » Dynamic Variable Declaration how to do ? (merged)
Dynamic Variable Declaration how to do ? (merged) [message #304133] Tue, 04 March 2008 04:01 Go to next message
rangan.s
Messages: 75
Registered: February 2008
Location: chennai
Member
Is it possible To declare a variable dynamically? in an pl/sql block?
Re: Is it possible To declare a variable dynamically? [message #304135 is a reply to message #304133] Tue, 04 March 2008 04:13 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What is your actual problem?

Regards
Michel
Re: Is it possible To declare a variable dynamically? [message #304139 is a reply to message #304135] Tue, 04 March 2008 04:26 Go to previous messageGo to next message
rangan.s
Messages: 75
Registered: February 2008
Location: chennai
Member
I AM HAVING ONE TABLE WITH TWO COLUMNS ONE IS CONTAINING THE NAME OF THE TABLE ANOTHER IS CONTAINING CORRESPONDING COLUMNS USING COMMA SEPARATED I WANT TO SPLIT OF THOSE COLUMNS FOR THE REPECTIVE TABLE

WE I HAVE ONE FUNCTION TO SPLIT THE COMMAS NOW I WANT TO WRITE INTO TEXT FILE.

I AM USING FIRST CURSOR TO SPLIT UP

SECOND CURSOR TO WRITE INTO FILE

FOR THE SECOND CURSOR I NEED TO GET COUNT OF VARIABLE FROM THE
FIRST CURSOR AND I WANT TO DECLARE ALL VARIALRES AS VARCHAR2(4000);

Re: Is it possible To declare a variable dynamically? [message #304142 is a reply to message #304133] Tue, 04 March 2008 04:37 Go to previous messageGo to next message
mshrkshl
Messages: 247
Registered: September 2006
Location: New Delhi
Senior Member
Don't write in caps lock.

useful link

http://www.oreilly.com/catalog/ornewfeatures/chapter/ch04.html

regards,
Re: Is it possible To declare a variable dynamically? [message #304144 is a reply to message #304139] Tue, 04 March 2008 04:55 Go to previous messageGo to next message
Michel Cadot
Messages: 64139
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I can't read post in capitals.
Read OraFAQ Forum Guide

Post a test case: create table and insert statements.
Also post the result you want with these data.

Regards
Michel
Re: Is it possible To declare a variable dynamically? [message #304357 is a reply to message #304144] Wed, 05 March 2008 00:15 Go to previous messageGo to next message
rangan.s
Messages: 75
Registered: February 2008
Location: chennai
Member
I have one table say tab_det having two columns

Tab_det
---------

Tab_tablename varchar2(50),Tab_tablename varchar2(50)


Select * from tab_det;

Tab_tablename ---> Tab_tablename
-----------------------------------------------
Emp ---> empno,empname,dept
Emp_acct ---> empno,accno,accname,age

I want to split the each column name from <Tab_tablename > because it contains all the
Column name with comma separated and as a single value

I want to split the column name for each < Tab_tablename> Corresponding to
< Tab_tablename>

And I want to pass the column names dynamically and the output need to be written into the File



The Required Output In File

Empno empname dept
1 aaa cs
2 bbb ec
3 ccc ec

Empno accno accname age
1 12 aaa 34
2 13 bbb 36
3 14 ccc 38
4 14 ddd 40




Dynamic Variable Declaration how to do ? [message #304358 is a reply to message #304133] Wed, 05 March 2008 00:17 Go to previous messageGo to next message
rangan.s
Messages: 75
Registered: February 2008
Location: chennai
Member
I have one table say tab_det having two columns

Tab_det
---------

Tab_tablename varchar2(50),Tab_tablename varchar2(50)


Select * from tab_det;

Tab_tablename ---> Tab_tablename
-----------------------------------------------
Emp ---> empno,empname,dept
Emp_acct ---> empno,accno,accname,age

I want to split the each column name from <Tab_tablename > because it contains all the
Column name with comma separated and as a single value

I want to split the column name for each < Tab_tablename> Corresponding to
< Tab_tablename>

And I want to pass the column names dynamically and the output need to be written into the File



The Required Output In File

Empno empname dept
1 aaa cs
2 bbb ec
3 ccc ec
Empno accno accname age
1 12 aaa 34
2 13 bbb 36
3 14 ccc 38
4 14 ddd 40
Re: Dynamic Variable Declaration how to do ? [message #304360 is a reply to message #304358] Wed, 05 March 2008 00:19 Go to previous messageGo to next message
mshrkshl
Messages: 247
Registered: September 2006
Location: New Delhi
Senior Member
please post in prescribed format(read forum guide).

regards,
Re: Dynamic Variable Declaration how to do ? [message #304362 is a reply to message #304358] Wed, 05 March 2008 00:20 Go to previous messageGo to next message
pablolee
Messages: 2835
Registered: May 2007
Location: Scotland
Senior Member
Do not duplicate your posts continue with the old one.
Re: Is it possible To declare a variable dynamically? [message #304372 is a reply to message #304133] Wed, 05 March 2008 00:31 Go to previous message
mshrkshl
Messages: 247
Registered: September 2006
Location: New Delhi
Senior Member
use this link to solve your problem

http://www.orafaq.com/forum/m/297050/92734/#msg_297050

please post always in prescribed format(read forum guide).

regards,

[Updated on: Wed, 05 March 2008 00:35]

Report message to a moderator

Previous Topic: Partitioning strategy for over time transactions
Next Topic: Help to bring Closing Balance from this SQL
Goto Forum:
  


Current Time: Thu Dec 08 18:19:13 CST 2016

Total time taken to generate the page: 0.24983 seconds