Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

about ora-01006 :bind variable does not exist

Aymen Ben HeniaDec 4 2013 — edited Dec 4 2013

Hi all of you,i have this dynamic sql :

DECLARE

v_query clob;

cpt number;

begin

v_query:='

SELECT

count(TBA.ANT_ID)

  FROM

    ...

WHERE TBA.ANT_FUT_ID = TFT.FUT_ID

       AND TBA.ANT_KATEGORIE_CODE_ID = TAKCL.ANT_KATEGORIE_CODE_ID(+)

       AND TBA.ANT_KFZ_REIHEN_ID = TKR.KFZ_REIHEN_ID(+)

       AND TBA.ANT_ID = F1.ANT_ANT_ID(+)

       AND TBA.ANT_ID = F2.ANT_ANT_ID(+)

       AND TBA.ANT_ID = F3.ANT_ANT_ID(+)

       AND TBA.ANT_ID = ERS.ers_bdk(+)

       AND TBA.ANT_ID = F1_2.ANT_ANT_ID(+)

       AND TBA.ANT_ID = F2_3.ANT_ANT_ID(+)

       AND TBA.ANT_ID = MFU.MFU_ANT_ID(+)

       AND MFU.MFU_NIETGEOMETRIE_ID = NG.NG_ID(+)

       AND MFU.MFU_MATRIZEN_BEICHNUNG_ID = MZB.MZB_ID(+)

    --------------------

    -- Suchkriterien: --

    --------------------

   

    --Ersteller

    AND  DECODE( ERS.ers_id, NULL, ''%'', ERS.ers_name ) LIKE DECODE('':1'',NULL,''%'','''')||''''|| :1 ||''''||DECODE('':1'',NULL,''%'','''')

     --Fahrzeug

    AND  DECODE( TKR.NAME, NULL, ''%'', TKR.NAME ) LIKE DECODE('':2'',NULL,''%'','''')||''''|| :2 ||''''|| DECODE('':2'',NULL,''%'','''')

     --BDK

    AND  DECODE( fuege_db.bdk_nummer( TBA.ANT_ID,''.'' ), NULL, ''%%'',

   fuege_db.bdk_nummer( TBA.ANT_ID,''.'' ) )   LIKE ''%''||:3||''%''

    --Technologie

    AND  TBA.ANT_FUT_ID LIKE DECODE('':4'',NULL,''%'','''')||''''|| :4 ||''''||DECODE('':4'',NULL,''%'','''')

     --Art

    AND ((TBA.ANT_WFP_ID is null and 1=DECODE('':5'',NULL,1,1,1) ) or (TBA.ANT_WFP_ID is not null and 2=DECODE('':5'',NULL,2,2,2)))

    --VTA

    AND TBA.ANT_VTA = decode('':6'',1,1,TBA.ANT_VTA)  ';

execute immediate v_query

into cpt USING

'Dominik Hussmann',

'AU736_Q7_SUV' ,

'' ,

'WPS Stahl',

'',

'0';  

end ;

In the execution,i have this error :ora-01006 :bind variable does not exist, after analyzing,i have found that the problem is with parameters :5 and :6 ,i don't understand they have the same syntax

as bind variables 1,2,3 and 4.

Than you for any suggestion.

This post has been answered by theoa on Dec 4 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 1 2014
Added on Dec 4 2013
6 comments
774 views