RE: For god sake (help me) PL/SQL dynamic sql

RE: For god sake (help me) PL/SQL dynamic sql

 

  

Maybe this is what you want?
select 'insert into employees values ('||
employee_id||','||
''''||first_name||''','||
''''||last_name||''','||
''''||email||''','||
''''||phone_number||''','||
'to_date('||to_char(hire_date, 'YYYYMMDD')||',
''YYYYMMDD''),'||
job_id||','||
salary||','||
commission_pct||','||
manager_id||','||
department_id||
')'
from employees
where hire_date < sysdate + 1

Just take care of the null allowed columns...

Cheers


-----Original Message-----
From: Kedar Barde
[mailto:oracledba-ezmlmshield-x514318.[Email address protected]
Sent: Wednesday, March 05, 2008 10:07 AM
To: LazyDBA Discussion
Subject: RE: For god sake (help me) PL/SQL dynamic sql

Check your date format on the client machine whether its DD-MM-YYYY or
DD-MON-YYYY for SQL below



Kedar Barde

Oracle 9i DBA

Oracle Certified Associate(OCA)



-----Original Message-----
From: ab265
[mailto:oracledba-ezmlmshield-x60636988.[Email address protected]
Sent: 05 March 2008 01:51
To: LazyDBA Discussion
Subject: For god sake (help me) PL/SQL dynamic sql



Experts,



For god sake help me doing that. I am trying to insert data from table
to table depending on specific date. I want to do the following:



1- select data from 06-02-2007 day by day to 02-02-2008.



2- insert into another table day by day (one by one).



Best result i am looking for is a statement like the one below. It
didn't work actually. I have been trying for a long time. I need to
supstitue sysdate in the code withe specific date like 06-02-2007.



I want this dynamic sql to run and give me all the inserts statement day
by day so i can execute them one by one. For god sake, help me.



select 'INSERT INTO scott.emp_test SELECT * '|| FROM scott.emp || '
WHERE a.hiredate' ||' ' < ' || sysdate + 1 ;



Thanks,


"Any of the statements or comments made above should be regarded as
personal and not necessarily those of Velindre NHS Trust, any
constituent part or connected body

Dylai'r datganiadau neu'r sylwadau uchod gael eu trin fel rhai personol
ac nid o reidrwydd fel datganiadau neu sylwadau gan Ymddiriedolaeth GIG
Felindre, unrhyw ran ohono neu unrhyw gorff sy'n gysylltiedig a'r
Ymddiriedolaeth".



---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
To post a dba job: http://jobs.lazydba.com
To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html



Oracle LazyDBA home page