How to pass variables to the Execute Query

Hi,

I have below query: which should accept input from application
“Select COUNT(A.CIF_ID) CIF_Status
From TBAADM.GAM A, CUSTOM.C_CEX B, TBAADM.CMG C
Where 1=1
And A.FORACID= 'Variable1’
And A.CIF_ID=C.CIF_ID
And A.CIF_ID=B.EXCLUSIVE_VALUE
And (C.CUST_FIRST_NAME Like ‘%Variable2%’ or CUST_LAST_NAME like ‘%Variable3%’)
And UPPER(B.EXCLUSIVE_LIST_TYPE)=‘CUST_ID’”

Here Variable1 = 123456, Variable2 = KUMAR, Variable3 = KIRAN

How to do it?

hi
with @ symbol before the variable name like this
And A.FORACID= @Variable1

Cheers @Kiranaarpa

Hi,

@Variable1 = 12345678901
What datatype should I define to store the value?

of type string
@Kiranaarpa

I am getting this Error “Execute Query: ORA-01036: illegal variable name/number”

Hi,

I am getting this error “Execute Query: ORA-01036: illegal variable name/number”

My database accepts number, but if I send StringVariable = “12345678901”. Will it send as a number to database?

“Select COUNT(A.CIF_ID) CIF_Status
From TBAADM.GAM A, CUSTOM.C_CEX B, TBAADM.CMG C
Where 1=1
And A.FORACID= 'Variable1’
And A.CIF_ID=C.CIF_ID
And A.CIF_ID=B.EXCLUSIVE_VALUE
And (C.CUST_FIRST_NAME Like ‘%" & variable2 & “%’ or CUST_LAST_NAME like ‘%” & variable3 & "%’) And UPPER(B.EXCLUSIVE_LIST_TYPE)=‘CUST_ID’”

kindly try with this and let know pls
@Kiranaarpa

“Select COUNT(A.CIF_ID) CIF_Status
From TBAADM.GAM A, CUSTOM.C_CEX B, TBAADM.CMG C
Where 1=1
And A.FORACID= ‘AccountNo’
And A.CIF_ID=C.CIF_ID
And A.CIF_ID=B.EXCLUSIVE_VALUE
And (C.CUST_FIRST_NAME Like '%” & FirstName & “%’ or CUST_LAST_NAME like '%” & LastName & “%’)
And UPPER(B.EXCLUSIVE_LIST_TYPE)=‘CUST_ID’”

Giving compilation error

“Select COUNT(A.CIF_ID) CIF_Status
From TBAADM.GAM A, CUSTOM.C_CEX B, TBAADM.CMG C
Where 1=1
And A.FORACID= ‘AccountNo’
And A.CIF_ID=C.CIF_ID
And A.CIF_ID=B.EXCLUSIVE_VALUE
And (C.CUST_FIRST_NAME Like '%” & FirstName & “%’ or CUST_LAST_NAME like '%” & LastName & “%’)
And UPPER(B.EXCLUSIVE_LIST_TYPE)=‘CUST_ID’”

Giving Compilation error

hmm… let me check once
will get back to you buddy
@Kiranaarpa