Home > database >  For help: regarding the use of the embedded SQL statement in (dynamic SQL)
For help: regarding the use of the embedded SQL statement in (dynamic SQL)

Time:12-25

After the input supplier code, you need to determine whether the supplier belongs to authority stores, write dynamic SQL

='select s_sql sup_code sup_desc, man_type, cont_code, founded_time, determine_timecen_person, stat_flag, abc_class from: supplier where sup_code="' + supcode + '" and shop_own in (' + ls_shop +') '

Declare cur_shop dynamic cursor for sqlsa;

Prepare sqlsa from: ls_sql;
The open dynamic cur_shop;
The fetch cur_shop into: supcode, : supdesc, mantype, : contcode foundeddate, : determinedate, : enrolperson, statflag, : abcclass;
The close cur_shop;


LS_shop is I was ready to store strings, but found not in the store suppliers can also found out
With essentially a event viewer tracking and code is as follows:

Declare @ P1 int
The set @ P1=0
Declare @ P2 int
The set @ P2=2
Declare @ P3 int
The set @ P3=0
Exec sp_cursoropen @ cursor=@ P1 output, @ STMT='select sup_code, sup_desc, man_type, cont_code, founded_time, determine_timecen_person, stat_flag, abc_class from: supplier where sup_code="80381" and shop_own in (" 002 ", "003", "004", "005", "006")', @ scrollopt=@ P2 output, @ ccopt=4, @ rows=@ P3 output
Select @ P1, @ P2, P3 is @

Supplier's 001 stores, 80381 is not in any stores, under the condition of why would look it up?
  • Related