Quote in exxecuute immediate

Hi All,
I'm in oracle 10g2.
I have the following dynamic sql.. There is some issue with the quotes in the input parameter.
execute immediate(q'[alter materialized view ||r_invalid_view.mview_name compile]');Appreciate your help.
Thanks in advane
NU

Hi,
You don't need the quote operator in this case :
execute immediate('alter materialized view ' || r_invalid_view.mview_name || ' compile');

Similar Messages

  • Escape '  ' while creating a collection in Oracle APEX

    Hi all
    I am creating a collection where I am using substr and instr functions and it does give an error message as below
    • ORA-06550: line 14, column 79: PLS-00103: Encountered the symbol ", -1)) OWSR, null PRIM_ADD , null PRIMA" when expecting one of the following: ) , * & = - + < / > at in is mod remainder not rem <an exponent (**)> <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset
    Relevant Portion where the error pops up:
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY(
    p_collection_name => 'RANGE_COLLECTION',
    p_query => 'SELECT
              :P999_LOC_TYPE ADD_TYPE_ID
              , TRIM(:P999_OWSR) PRIM_ST
              , SUBSTR(TRIM(:P999_OWSR),1,1) PRIM_DIR
              , SUBSTR(TRIM(:P999_OWSR),INSTR(TRIM(:P999_OWSR), ' ', -1)) PRIM_SUF
    ......... on the line below
    SUBSTR(TRIM(:P999_OWSR),INSTR(TRIM(:P999_OWSR), ' ', -1)) PRIM_SUF
    Does anyone have any solution how to escape the single quotes in Oracle APEX 4.2. - like \' or something? I already tried using backslash but had no luck.
    Would really appreciate your help ASAP.
    Thanks,
    Rads

    Rads wrote:
    Does anyone have any solution how to escape the single quotes in Oracle APEX 4.2. - like \' or something? I already tried using backslash but had no luck.Quotes in string liberals in Oracle are escaped by doubling them up:
    execute immediate 'update emp set sal = sal * 1.2 where ename = ''SCOTT''';However a better approach when dealing with SQL strings is to use the alternative quoting mechanism:
    execute immediate q'{update emp set sal = sal * 1.2 where ename = 'SCOTT'}';as this allows the original string to be left unaltered.

  • How to Restrict the Continuous Absences in 2001

    Hi,
    We have maximum eligibilty of CL is 3days . After the 3 days of quota, system accepting immediate 3 days as CL in infotype 2001. so total 6 days CL quota is continuously coming. how to restrict this for only 3days.
    another case is after 3 days CL, immediately emplyee appying for SL quota also. as per client requirement we need to restrict that.
    please guide me

    Dear SK,
    I do not have the knowledge on Development side, could you please give me the brief information about USER EXIT and in which report we need to do the development. its very urgent requirement
    Thanks & Regards
    BVB

  • How to create a oracle table in PLSQL Stored Procedure ?

    Gurus,
    Any one send the example link to me to create a oracle table through stored procedure ?
    Thanks.
    S

    begin
    EXECUTE IMMEDIATE "CREATE TABLE BLAH (COL1
    NUMBER)";
    nd;By the way, it raises a question as to why you need
    to create a table dynamically?
    Cheers
    Sarma.By the way, you wouldn't use double quotes for execute immediate:
    begin
       EXECUTE IMMEDIATE "CREATE TABLE BLAH (COL1 NUMBER)";
    end;
    Error at line 1
    ORA-06550: line 2, column 22:
    PLS-00114: identifier 'CREATE TABLE BLAH (COL1 NUMBER' too long
    SQL> begin
       EXECUTE IMMEDIATE 'CREATE TABLE BLAH (COL1 NUMBER)';
    end;
    PL/SQL procedure successfully completed.

  • Execute DDL statements from pl / sql

    Hi !!!!
    I have to create every object (tables, sequences, etc) using a pl / sql block, so I need first looking for the object in the data dictionary and if it doesn't exist execute a ddl statement to create it.
    I wanted to execute at the same "execute immediate " :
    - create table.
    - create synonym for the table created before.
    - comments on table
    - comments on table's columns
    - grants on the table.
    But I found some errors:
    - I can`t have semicolon after every statement so I get an "ORA-00911: invalid character". I did'nt try to scape the semicolon so I need it.
    - I split the execute immediate so now I have one execute immediate for every statement but I got an error in this statement:
    EXECUTE IMMEDIATE 'COMMENT ON TABLE SYSADM.CVP_PAQ_SMS_REC_PRUEBA IS "COMMENT ON TABLE"  '; The error I get is this:
    ORA-01780: string literal required
    Any suggestions about this ?
    Thanks.

    The comment itself needs to be a SQL string so it needs to be delimited with single quotes not double quotes. You can either use two single quotes
    EXECUTE IMMEDIATE 'COMMENT ON TABLE SYSADM.CVP_PAQ_SMS_REC_PRUEBA IS ''COMMENT ON TABLE''  ';or you can use the q quoting syntax
    EXECUTE IMMEDIATE q'[COMMENT ON TABLE SYSADM.CVP_PAQ_SMS_REC_PRUEBA IS 'COMMENT ON TABLE'  ]';You cannot combine multiple DDL statements into a single block (well, you could use dynamic PL/SQL, but then your string would have a bunch of embedded EXECUTE IMMEDIATE statements which would presumably not buy you much).
    Justin

  • Deletion of unwanted segment - error 26

    Hello
    Can somebody please let me know how to delete unwanted segments?
    I want to delete segment E1MARCM for unwanted plants. I am deleting this from BADI_MATMAS_ALE_CR, but I am unable to deal with its child segments.
    Thanks in advance
    Moderator message - Cross post locked
    Edited by: Rob Burbank on Mar 24, 2010 10:57 AM

    In theory the best way to get rid of unwanted segments without any coding is to introduce a filter in the distribution model (transaction BD64). However, this only works if you're using ALE and you know up-front which values you want or don't.
    In your case though it sounds as if you need dynamic filtering, i.e. it depends from case to case which plant segments are wanted. Thus a simple coding routine that deletes unwanted E1MARCM segments along with its children should do.
    Here's some untested ABAP code that probably has some errors. The idea is simply to recursively delete the given IDoc segment (specified in SEGNUM) along with all it's children (i.e. the ones that reference in PSGNUM the given segment number):
    form DELETE_SEGMENT using    SEGNUM    type EDI_DD40-SEGNUM
                        changing EDIDD_TAB type EDI_DD40_TT.
      data EDIDD type EDI_DD40.
      &quot; Delete the parent segment
      delete EDIDD_TAB where SEGNUM = SEGNUM.
      &quot; Delete children of parent segment and their children
      loop at EDIDD_TAB into EDIDD where PSGNUM = SEGNUM.
        &quot; Delete the immediate child
        delete EDIDD_TAB index sy-tabix.
        &quot; Now recursively delete all it's children
        perform DELETE_SEGMENT using    EDIDD-SEGNUM
                               changing EDIDD_TAB.
      endloop.
    endform.
    As I said, just the rough outline. Coding is untested and I'm not completely sure if the looping and deleting really works. Might be better to mark the unwanted segments first and then delete them. E.g. if your IDoc number is filled, then you could for example clear the IDoc number in the table for all unwanted segments and then delete them en-block once you're done.
    Cheers, harald

  • Deletion of unwanted segments error 26

    Hello
    Can somebody please let me know how to delete unwanted segments?
    I want to delete segment E1MARCM for unwanted plants. I am deleting this from BADI_MATMAS_ALE_CR, but I am unable to deal with its child segments.
    Thanks in advance

    In theory the best way to get rid of unwanted segments without any coding is to introduce a filter in the distribution model (transaction BD64). However, this only works if you're using ALE and you know up-front which values you want or don't.
    In your case though it sounds as if you need dynamic filtering, i.e. it depends from case to case which plant segments are wanted. Thus a simple coding routine that deletes unwanted E1MARCM segments along with its children should do.
    Here's some untested ABAP code that probably has some errors. The idea is simply to recursively delete the given IDoc segment (specified in SEGNUM) along with all it's children (i.e. the ones that reference in PSGNUM the given segment number):
    form DELETE_SEGMENT using    SEGNUM    type EDI_DD40-SEGNUM
                        changing EDIDD_TAB type EDI_DD40_TT.
      data EDIDD type EDI_DD40.
      &quot; Delete the parent segment
      delete EDIDD_TAB where SEGNUM = SEGNUM.
      &quot; Delete children of parent segment and their children
      loop at EDIDD_TAB into EDIDD where PSGNUM = SEGNUM.
        &quot; Delete the immediate child
        delete EDIDD_TAB index sy-tabix.
        &quot; Now recursively delete all it's children
        perform DELETE_SEGMENT using    EDIDD-SEGNUM
                               changing EDIDD_TAB.
      endloop.
    endform.
    As I said, just the rough outline. Coding is untested and I'm not completely sure if the looping and deleting really works. Might be better to mark the unwanted segments first and then delete them. E.g. if your IDoc number is filled, then you could for example clear the IDoc number in the table for all unwanted segments and then delete them en-block once you're done.
    Cheers, harald

  • HP 1000 notebook shuts off in every 30 minutes

    i've been experiencing a very weird problem in my hp 1000-1405TU notebook.<br><br>My
    notebook shuts down - not the &quot;windows is shutting down&quot; type, but immediate loos of power shut down.<br><br>I thought it was shutting down because it was overheating, to eliminate the overheating option i installed SpeedFan and in some cases (idling, music, movies) temperature was about 50-60 Deg C. but i cleaned it with compressed air just in case.<br><br><br><br>I thought it might be a virus (even though i have antivirus program), so i tried booting up in safe mode - same effect, tried leaving it in BIOS - same effect<br><br><br><br>but then i noticed it is shutting down exactly 30 minutes after powering up. doesn't matter if i'm playing games, watching movies, listening to music or letting it idle - at 30min. mark it just powers off.<br><br><br><br>i tested it on battery power, on main supply with and without battery - the effect is always the same.<br><br><br><br>Hard Disk test - PASSED<br><br>Memory Test - PASSED<br><br>Battery Test - PASSED<br><br>need help very badly

    Responded on duplicate thread: http://h30434.www3.hp.com/t5/Notebook-Operating-Systems-and-Software/HP-1000-3rd-gen-notebook-sudden...
    TwoPointOh
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom to say “Thanks” for helping!

  • Charges are just too high.

    My bill is absolutely too high. I have 2 TV's w/2 boxes & 1 laptop using wifi. I am going to have to call Comcast today & drop the cable TV service. I want to keep the internet. 75 years old w/pancreatic cancer. Medical bills coming out of my ears. Can't afford this & do not understand why you are charging so much. I love the service just can't afford it. Wonder how a lot of people do? Always I am quoted a certain $ amount & it creeps up & up! Thanks 

    This is the first time I have complained about my charges. Received response from Comcast quoting a significant savings. I hope they hold true to what they quoted. I am sorry you didn't have good luck with what you were told. Doesn't sound good at all. I appreciate their offering to do this & really hope they stick to what was quoted. If not, I will have to go elsewhere. Thanks for your response.Thomaspetrone wrote:
    I have tried 3 times, to update my account to get a decent plan from Xfinity and have not worked out as expected or explained.
    What I have noticed is that each time I am verbally promised an Xfinity package of a certain price, I am then charged a significant amount above that quoted price. hardware or channels which were promised as part of the package price are then charged additional fees.
    This is either fraudulent or poor training on customer service to misrepresent their capabilities.
    I would appreciate an honest quote and an immediate change of my fees so that I am not paying significantly more. If Xfinity cannot put in writing a cable and Internet package with AT LEAST equivalent, or higher, capabilities than what I previously was paying for, then I will gladly persued other television and Internet providers. I know it's a pain to change, but if you want better service a prices, sometimes you have to go elsewhere.
    I am tired of the multiple broken promises and run around that I have received in the last 2 months and would appreciate an honest accurate statement in writing. 

  • Single quotes problem with execute immediate

    Thanks for considering to solve the issue.
    [i]Situation:
    I am trying to create a procedure to perform a set of operations. As part of that, I am trying to create a table using execute immediate statement. This create table statement has a select sub query where p_LOB3 is the variable for the procedure of datatype varchar2.
    Problem :
    I need to pass the variable p_LOB3 as single quoted as it is of type Varchar2. Also I need to enclose the entire create table query within single quotes. How do I specify this as it is throwing an error when the PL/SQL engine is parsing the single quotes in the query used twice for different purposes as mention earlier.
    Query:
    execute immediate'create table test5 as select min(contract_number)as contract_number,contact_id,max(line_of_business) as line_of_business from mytable group by contact_id having min(contract_number) = max(contract_number) and max(Line_of_business) = 'p_LOB3' ';

    Thank you Todd,
    Is just worked fine.
    New issue is: I am not able to put 2 such statements in a single procedure and execute. Before I give parameters to the procedure, PL/SQL engine is actually creating a view of the mytable and naming is as test5, as a result I am not able to create a table as there is a view with the same name.
    Right now, the workaround I am using is to create three different procedures to create three such tables. I know this is not a good idea....can you please tell me if there is a better way.
    Procedure
    CREATE OR REPLACE PROCEDURE SP_CREATE_0_0(p_LOB1 IN varchar2, p_LOB2 IN varchar2)
    IS
    BEGIN
    execute immediate 'create table test5 as select min(contract_number) as
    contract_number,contact_id,max(line_of_business) as line_of_business from
    mytable group by contact_id having min(contract_number) = max(contract_number)
    and max(Line_of_business) = ' ' ' || p_LOB1 || ' ' ' ';
    execute immediate 'create table test5 as select min(contract_number) as
    contract_number,contact_id,max(line_of_business) as line_of_business from
    mytable group by contact_id having min(contract_number) = max(contract_number)
    and max(Line_of_business) = ' ' ' || p_LOB1 || ' ' ' ';
    END SP_CREATE_0_0;
    /

  • Dynamic SQL and Data with Single Quotes in it.

    Hi There,
    I have a problem in that I am using dynamic SQL and it happens that one of the columns does contain single quotes (') in it as part of the data. This causes the resultant dynamic SQL to get confused as the single quote that is part of the data is taken to mean end of sting, when in fact its part of the data. This leaves out a dangling single quote that was meant to enclose the string. Here is my dynamic SQL and the result of the parsed SQL that I have captured:
    ****Dynamic SQL*****
    l_sql:='select NOTE_TEMPLATE_ID '||
    'FROM TMP_NOTE_TEMPLATE_VALUES '||
    'where TRIM(LEGACY_NOTE_CODE)='''||trim(fp_note_code)||''' '||
    'and TRIM(DISPLAY_VALUE)='''||trim(fp_note_text)||''' ';
    execute immediate l_sql INTO l_note_template_id;
    Because the column DISPLAY_VALUE contains data with single quotes, the resultant SQL is:
    ******PARSED SQL************
    select NOTE_TEMPLATE_ID
    FROM TMP_NOTE_TEMPLATE_VALUES
    where TRIM(LEGACY_NOTE_CODE)='INQ' and TRIM(DISPLAY_VALUE)='Cont'd'
    And the problem lies with the single quote between teh characters t and d in the data field for DISPLAY_ITEM. How can I handle this?
    Many thanks,

    I have been reliably informed that if one doesn't enclose char/varchar2 data items in quotes, the right indices may not be usedI am into oracle for past 4 years and for the first time i am hearing this.
    Your reliable source is just wrong. Bind variables are variables that store your value and which are used in SQL. They are the proper way to use values in your SQL. By default all variables in PL/SQL is bind variable.
    When you can do some thing in just straight SQL just do it. Dynamic SQL does not make any sense to me here.
    Thanks,
    Karthick.

  • Execute immediate -- udpate statement

    Hello,
    I am fairly new to scripting sql..pl/sql.. any help will be really appreciated!!
    I have a table where i am trying to update one of the column with table name i am passing dynamically.
    However i get the invalid identifier error. ORA-00904. The column AD.MIR_PARENT i am updating is of compatible data type.
    Any help please.. where i am doing a mistake..
    fyi -- the reason i am updating the column with table name is because i need to know which table i make a hit.
    DECLARE
    p_table varchar2(200);
    P_SCHEMA varchar2(200);
    p_acct NUMBER;
    v_acct NUMBER;
    P_column varchar2(200);
    cursoR c is
    select schema_name, table_name, column_name from addnl_sources where TABLE_NAME = 'ACCT';
        BEGIN
            FOR R IN C LOOP
                                    p_TABLE := R.TABLE_NAME;
                                    P_SCHEMA := R.SCHEMA_NAME;
                                    P_column := R.column_name;
                       execute immediate 'UPDATE ACCT_DELETE AD
                SET AD.MIR_PARENT = '||p_table || '
                WHERE EXISTS (select "'||p_table || '" from "' || P_SCHEMA||'"."'||p_table || '" where "' || P_column ||'" = ad.acct_id )
                AND AD.EXCLUDE IS NULL
                AND AD.ACCT_ID = 472039
                AND AD.MIR_PARENT IS NULL' ;
                            END LOOP;
        end;Edited by: 982806 on Jan 18, 2013 10:47 AM
    Edited by: 982806 on Jan 18, 2013 11:04 AM

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION)
    >
    I am fairly new to scripting sql..pl/sql.. any help will be really appreciated!!
    I have a table where i am trying to update one of the column with table name i am passing dynamically.
    However i get the invalid identifier error. ORA-00904. The column AD.MIR_PARENT i am updating is of compatible data type.
    Any help please.. where i am doing a mistake..
    >
    Just about everything you are doing is a mistake.
    1. You using PL/SQL instead of SQL to do this job? That is usually a red flag that something is wrong about what you are trying to do or how you are trying to do it.
    2. You are 'fairly new to scripting' and have chosen to use dynamic sql? That is one of the harder techniques to learn and to use properly and is another red flag. Experienced professionals often don't use dynamic sql properly and often use it when they shouldn't.
    3. You are using a loop to execute against multiple tables? It is extremely difficult to perform proper error handling and recovery when you do this. What if some of the tables get updated and others don't? How will you know which ones still need to be updated? How will you roll back the data if you need to.
    4. You have opened a GIGANTIC opportunity for sql injection where the wrong tables could accidentally be updated. That could corrupt the data and reek havoc on the system. Anyone could, accidentally or intentionally, put the wrong schema, table or column in your lookup table and cause enormous damage.
    5. You are using double quotes in PL/SQL? Where did you learn that?
                WHERE EXISTS (select "'||p_table || '" from "' || P_SCHEMA||'"."'||p_table || '" where "' || P_column ||'" = ad.acct_id ) Finally, it is standard practice when you do have a use case for dynamic sql to construct the query in a variable and then print the query or write it to a log file so it can be tested independently.
    If you do that you will likely see your error.
    query VARCHAR2(4000);
    query := 'UPDATE . . .';
    execute immediate query;SUMMARY: don't try to automate something until you can first do it manually. Write a query that works properly first. Then, and only then, convert it to dynamic sql.

  • String with embedded single quote

    Hi, all. We're trying to pass a string from one procedure to another, which will then do an EXECUTE IMMEDIATE on it. However, there are single quotes withing the string, and they're driving us nuts! This is what the concatenated string should look like when passed to the pw_execDDL procedure:
    insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values ('MEAG', to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
    Here's the concatenation process that doesn't work, and there are functions being called within the string:
    chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (' || '''' || prm_inoc_id || '''' || ', ' || 'to_date(' || '''' || prm_proof1 || ''''||','||'''' ||'DD-MMM-YY'||''''||')' || ', ' || '''' || fw_is_proof_valid(prm_birth_date, prm_proof1) || '''' || ',1);';
    pw_execDDL(chr_sql); /* call the procedure to do the EXECUTE IMMEDIATE */
    Help! We've tried every combination -- using two single quotes together, three, and four, and still no luck. Thanks.

    insert into appimmunization.wsrprfs (inoc_id, proof,
    is_valid,proof_num) values ('MEAG',
    to_date('02-OCT-05','DD-MMM-YY'), 'Y',1);
    This statement can be made in a string with the following affectation:
    chr_sql := 'insert into appimmunization.wsrprfs (inoc_id, proof, is_valid,proof_num) values (''MEAG'', to_date(''02-OCT-05'',''DD-MMM-YY''), ''Y'',1)';
    Note please that each single quote in your original string must be specified using two single quotes and that is all. It is more readable and more easy to do it this way.
    Michel.

  • Replace a string single quote(') with underscore(_)

    I have more than 100 tables in a schema.
    I have to find out if a string has a single quote in the column and replace it with an underscore.
    I have 2 columns CREATE_USER and UPDATE_USER in all the tables. Now i want to update the values if the string has a single quote in it.
    I tried it with execute immediate but it is not allowing underscore in the statement.
    DECLARE
       v_table_name    VARCHAR2 (30);
       v_column_name   VARCHAR2 (30);
       CURSOR c_name
       IS
          SELECT DISTINCT table_name, column_name
                     FROM user_tab_cols
                    WHERE column_name IN ('LOGIN', 'CREATE_USER', 'UPDATE_USER')
                      AND table_name NOT LIKE '%JN';
    BEGIN
       FOR rec IN c_name
       LOOP
          v_table_name     := rec.table_name;
          v_column_name    := rec.column_name;
          EXECUTE IMMEDIATE    'update '
                            || v_table_name
                            || ' set '
                            || v_column_name
                            || ' = REPLACE('
                            || v_column_name
                            || ','''',"_") where '
                            || v_column_name
                            || ' like "%''%"';
       END LOOP;
    END;
    /i am getting the below error:
    ORA-00904: "%'%": invalid identifier
    ORA-06512: at line 17Can anyone let me know what is the error in the statement and how to overcome it

    please try to replace your execute immediate with:
    EXECUTE IMMEDIATE  'update '
                            || v_table_name
                            || ' set '
                            || v_column_name
                            || ' = REPLACE('
                            || v_column_name
                            || ','''''''',''_'') where '
                            || v_column_name
                            || ' like ''%''''%''';You can check the statement when you take a look at the construction before like this:
    declare
      v_sql varchar2(1000);
    begin
       v_sql:= 'update '
                            || v_table_name
                            || ' set '
                            || v_column_name
                            || ' = REPLACE('
                            || v_column_name
                            || ','''''''',''_'') where '
                            || v_column_name
                            || ' like ''%''''%''';
       dbms_output.put_line(v_sql);
       execute immediate v_sql;
       ...Edited by: hm on 23.11.2010 01:43

  • Place single quote around string

    Hi,
    I am wondering how I can Place single quote around string in the following. I have tried double and triple quote but it doesn't take variable name from rec.tablename.
    any idea
    rec.table_name ==> 'rec.table_name'
    rec.column_name ==> 'rec.column_name'
    v_sql:= 'DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= ' || rec.table_name ;
    execute immediate v_sql;
    -- Insert Table Record in Sdo_User_Geom_Metadata
    v_sql:= 'INSERT INTO USER_SDO_GEOM_METADATA(TABLE_NAME, COLUMN_NAME, DIMINFO, SRID) ' ||
    'VALUES (' || rec.table_name || ',' || rec.column_name || ', MDSYS.SDO_DIM_ARRAY( ' ||
    'MDSYS.SDO_DIM_ELEMENT(''X'',-2147483648, 2147483647, .000005), ' ||
    'MDSYS.SDO_DIM_ELEMENT(''Y'',-2147483648, 2147483647, .000005)), 2958)' ;
    execute immediate v_sql;
    Nancy

    I have 2 suggestions, 2nd one being the better choice.
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    v_sql varchar2(4000);
      3    table_name varchar2(4000);
      4  begin
      5    table_name := 'MY_TABLE';
      6    v_sql:= 'DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= ''' || table_name || '''';
      7    dbms_output.put_line(v_sql);
      8  end;
      9  /
    DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= 'MY_TABLE'
    PL/SQL procedure successfully completed
    SQL> or using DBMS_ASSERT for a more elegant solution against SQL injection:
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
    Connected as fsitja
    SQL> set serveroutput on
    SQL>
    SQL> declare
      2    v_sql varchar2(4000);
      3    table_name varchar2(4000);
      4  begin
      5    table_name := dbms_assert.QUALIFIED_SQL_NAME('ALL_TABLES');
      6    v_sql:= 'DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= ' || dbms_assert.ENQUOTE_NAME(table_name);
      7    dbms_output.put_line(v_sql);
      8  end;
      9  /
    DELETE USER_SDO_GEOM_METADATA WHERE TABLE_NAME= "ALL_TABLES"
    PL/SQL procedure successfully completed
    SQL> [Docs referencing validation checks against SQL injection|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/dynamic.htm#LNPLS648]
    Regards,
    Francisco

Maybe you are looking for