Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2008
    Posts
    14

    Unanswered: Dynamic delete statement

    Is there any way the following dynamic delete statement can work without using 'execute immediate'?

    Code:
    create table temp_table (thevalue number);
    insert into temp_table values(5);
    insert into temp_table values(6);
    insert into temp_table values(5);
    
    
    declare
    	theTable varchar(15);
    	theColumn varchar(15);
    begin
    	theTable:='temp_table';
    	theColumn:='theValue';
    
    	Delete from theTable where theColumn=5;
    end;
    Thanks

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >Is there any way the following dynamic delete statement can work without using 'execute immediate'?
    NO!
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Mar 2007
    Posts
    623
    Quote Originally Posted by @ziggy View Post
    Is there any way the following dynamic delete statement can work without using 'execute immediate'?
    You may use DBMS_SQL. However, the called SQL statement is there also passed as a string.

  4. #4
    Join Date
    Jan 2008
    Posts
    14
    Thanks i will look into dbms_sql

  5. #5
    Join Date
    Sep 2011
    Posts
    75
    Quote Originally Posted by @ziggy View Post
    Is there any way the following dynamic delete statement can work without using 'execute immediate'?

    Code:
    create table temp_table (thevalue number);
    insert into temp_table values(5);
    insert into temp_table values(6);
    insert into temp_table values(5);
    
    
    declare
    	theTable varchar(15);
    	theColumn varchar(15);
    begin
    	theTable:='temp_table';
    	theColumn:='theValue';
    
    	Delete from theTable where theColumn=5;
    end;
    Thanks
    Hello,
    I think No

  6. #6
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    Must be home work.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  7. #7
    Join Date
    Jan 2008
    Posts
    14
    Quote Originally Posted by beilstwh View Post
    Must be home work.
    It is not as a matter of fact but thank you anyway for your pointless response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •