Hello ,
I need a solution that There is a static list
and I want to use this list as a table at select statement
like that :
SELECT * FROM (1,2,3,4)
result
------
1
2
3
4
thanks
[EDIT - moved from answers]
I need to run sql .
Indeed it is there is a list I need to insert it to a table
and I think I should use INSERT - SELECT
the list is like that :
(1,2,3,4,5 ... ) , I want to be able to use this list a table
and 1 is one row , 2 is an another row ....
am I able to explain ?
-----
It will just one time use-need .
it will not be used in sp and not with dinamic input.
My input is static and it is '17001','17002' ...
I just want to select from this list to use it for inserting another table as rows.
like that
INSERT INTO table1(col1)
(SELECT one_col_val FROM ('17001','17002' ... , '17007') )
NOT : one_col_val is one of '17001','17002' ...
I found a solution from internet but it is a little long solution but works
this is an example that I test does it work , and yes it works
create table xx (field1 varchar2(300) );
select * from xx;
insert into xx (select to_char(',17100,17300,17500,17700,') from dual);
INSERT INTO bddk_hesap_skont_pr(rapor_kod,satir,skont)
(
select 'MBFORM2',34,substr(field1,
instr(field1, ',', 1, rownum) + 1,
instr(field1, ',', 1, rownum + 1) -
instr(field1, ',', 1, rownum) - 1
) new_data
from xx ,
all_tables
where rownum <=
(
select length(
ltrim(
rtrim(
translate(field1, ',1234567890', ',')
)
)
) - 1 rc
from xx)
)
[/EDIT]