469,358 Members | 1,628 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Concat variable to form Table name inside Select statement

Are you looking for this?
Expand|Select|Wrap|Line Numbers
  1. SET @a = 'table';
  2. SET @x := CONCAT('SELECT * FROM ', CONCAT(@a, '_', 'name'));
  3. Prepare stmt FROM @x;
  4. Execute stmt;
This is equal to
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM table_name;




i need help,
how to Concat variable to form Table name inside insert statement in PL/SQL in oracle 7.3 ?

thank you..
Jan 22 '08 #1
4 10513
mwasif
801 Expert 512MB
Hi soelistyani,

Welcome to TSDN!!!

I am moving the question to Oracle Forum.
Jan 22 '08 #2
debasisdas
8,127 Expert 4TB
try like the following sample code snippet.

Expand|Select|Wrap|Line Numbers
  1. declare
  2. t_name carchar2(30) :=&t_name;
  3. str_ins varchar2(200);
  4. begin
  5. str_ins:='insert into' || t_name || 'values  (...........,........,..........);
  6.  
  7. execute immediate str_ins ;
  8. end;
  9.  
  10.  
Jan 23 '08 #3
vallis
1
Hello
I m also having requiremnet of same kind.
I would like to know how to concat a variable to a table in pl/sql
as i need to insert data from the concated table to a custom table
please help

thanks
Jan 25 '08 #4
debasisdas
8,127 Expert 4TB
Hello
I m also having requiremnet of same kind.
I would like to know how to concat a variable to a table in pl/sql
as i need to insert data from the concated table to a custom table
please help

thanks
kindly post the code that you are working on for reference of our experts.
Jan 25 '08 #5

Post your reply

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

Similar topics

4 posts views Thread by Nomen Nescio | last post: by
3 posts views Thread by r rk | last post: by
6 posts views Thread by GarryJones | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.