Solved

if (select...) = x then create table  command doesn't work Oracle 10g - please assist

Posted on 2009-04-09
2
665 Views
Last Modified: 2012-05-06
I am trying to create a new table when the status in another table = Yes and need help making this work.  Your assistance is appreciated.

(if select status from desaim_status where project_file_id = 2993;) = 'Yes';) then
create table desaim2993 as select * from inven_items_tracking where project_file_id = 2993;
0
Comment
Question by:gritscbs
2 Comments
 
LVL 2

Accepted Solution

by:
gnovakhs2n earned 500 total points
ID: 24110147
you cannot do a create table directly in PL/SQL, but you can use dynamic SQL:


declare v_status varchar2(100);
BEGIN
select max(status) into v_status from desaim_status where project_file_id = 2993;
if v_status= 'Yes' then
execute immediate 'create table desaim2993 as select * from inven_items_tracking where project_file_id = 2993';
end if;
END;

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question