Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-04-09
2
Medium Priority
?
670 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

609 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