?
Solved

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

Posted on 2009-04-09
2
Medium Priority
?
669 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
gnovakhs2n earned 2000 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

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

752 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