oracledbms-job

Replace ' by ''


I want to use DBMS_JOB.SUBMIT inside a function from package, I use it like this :

if i_iscsv then
    dbms('true');
    DBMS_JOB.SUBMIT(jobno,
                 'DECLARE            
                 BEGIN
                 get('||req||', '''||i_mail||'''); 
                 COMMIT;
                 END;
                 ');

The problem is from V_REQ, because I got a dbms like this :

DECLARE
                 BEGIN
                 get('
    select  distinct
         to_char( date, 'DD/MM/YYYY') date ......

instead of

DECLARE
             BEGIN
             get('
select  distinct
     to_char(date, ''DD/MM/YYYY'') date 

My V_REQ look like this :

 V_REQ := '
    select  distinct
         to_char(date, ''DD/MM/YYYY'') date .....

How can I do to replace ' by '' ?

Thanks


Solution

  • You can use Q'[]' instead of Single Quote

     V_REQ := Q'[select  distinct to_char(v.date_min, ''DD/MM/YYYY'') date]'
    

    See the difference here