Home > database >  Pb call a stored procedure is not successful
Pb call a stored procedure is not successful

Time:10-08

Pb call a stored procedure is not successful, but direct execution of success, the reason is that the stored procedure with dynamic retrieval: EXECUTE (' select * from table).
How to deal with this? Pray god solve,

CodePudding user response:

You write the code, it is going to do?

CodePudding user response:

reference 1st floor pb8 response:
you write the code, is going to do?

Inside a stored procedure for dynamic transfer line column, on the business need to do this,

CodePudding user response:

Using dynamic dw statements generated is the same

CodePudding user response:

Using PB dynamic SQL or dynamically create SQL grammar can achieve your demand, dynamic DW reference data window create syntax, dynamic SQL as shown in the figure below
STRING lsString lsSQL, lsTable, lsColumn
INT liInt
DATETIME liTime
LsSQL="SELECT * FROM the base WHERE code like?"
PREPARE SQLSA FROM lsSQL;
DESCRIB SQLSA INTO SQLDA; ∥ SQLDA contains a description of the input parameter
DECLARE cursor_base DYNAMIC CURSOR FOR SQLSA;
SetDynamicparm (SQLDA, 1, "32%") ∥ pass parameter values
The OPEN DYNAMIC cursor_base USING DESCRIPTOR SQLDA;
The FETCH cursor_base USING DESCRIPTOR SQLDA;
The DO WHILE SALCA. SQLCODE=0
FOR liInt=1 TO SQLDA. NumOutPuts
CHOOSE a CASE SQLDA. OutParmType [liInt]
CASE Typestring!
LsString=GetDynamicString (SQLDA, liInt)
∥ process the character of field
CASE TypeDateTime
LsDateTime=GetDynamicDateTime (SQLDA, liInt
∥ handles the field of type date
∥ processing other types of field
The END CHOOSE
NEXT
∥ a record of all of the fields will be taken after make the corresponding processing
The FETCH cursor_base USING DESCRIPTOR SQLDA;
LOOP
The CLOSE cursor_base;

CodePudding user response:

Prepare sqlsa from "the execute the stored procedure name";
The execute sqlsa
Commit;

CodePudding user response:

Can use the datawindow use stored procedures, more convenient,
  • Related