Home > database >  Questions about oracle in package storage
Questions about oracle in package storage

Time:10-06

I wrote a package, inside the package I variables defines a varchar s_id,
The select yijiid from mz_yiji1 where yijiid s_id in;
S_id=(' 1026962305 ', '1026962306', '1026962307', '1026962308', '1026962304')
But query query less than content
If I put the string select yijiid from mz_yiji1 where yijiid in (' 1026962305 ', '1026962306', '1026962307', '1026962308', '1026962304'), the query has a value, the great god can tell me why

CodePudding user response:

Process can't directly query, select yijiid from mz_yiji1 where yijiid in s_id; To select into
Can try other dynamic statement:
S_id=(' 1026962305 ', '1026962306', '1026962307', '1026962308', '1026962304');
V_sql:='select yijiid from mz_yiji1 where yijiid in' | | s_id;
The execute immediate v_sql into XXX;

CodePudding user response:

 - the writing will go wrong, 
S_id=(' 1026962305 ', '1026962306', '1026962307', '1026962308', '1026962304')

If more than one value, must be written as such, add a any
S_id=any (' 1026962305 ', '1026962306', '1026962307', '1026962308', '1026962304')
- or
S_id in (' 1026962305 ', '1026962306', '1026962307', '1026962308', '1026962304')


CodePudding user response:

reference 1st floor ghx287524027 response:
process can't directly query, select yijiid from mz_yiji1 where yijiid in s_id; To select into
Can try other dynamic statement:
S_id=(' 1026962305 ', '1026962306', '1026962307', '1026962308', '1026962304');
V_sql:='select yijiid from mz_yiji1 where yijiid in' | | s_id;
The execute immediate v_sql into XXX;


  • Related