Home > database >  PB call a stored procedure return value
PB call a stored procedure return value

Time:10-04

Stored procedures are defined as follows
Create procedure spc_test
(
@ STRSQL varchar (8000) the output
)
AS
The Begin
The Set @ STRSQL='Select B.V C_CUSTOMER_NAME,
Dr. C_company,
Dr. C_card_no,
Dr. C_tel,
The SUM (CASE WHEN Dr. C_year_month='2007-01 "' THEN a. d. _total_money ELSE NULL END) AS [2007-01],
SUM (CASE WHEN Dr. C_year_month="2007-02 'THEN a. d. _total_money ELSE NULL END), the AS/2007-02,
The SUM (CASE WHEN Dr. C_year_month='2007-03' THEN a. d. _total_money ELSE NULL END) AS/2007-03,
SUM (CASE WHEN Dr. C_year_month='the 2007-04' THEN a. d. _total_money ELSE NULL END), the AS/2007-04,
SUM (CASE WHEN Dr. C_year_month='2007-05' THEN a. d. _total_money ELSE NULL END), the AS/2007-05,
SUM (CASE WHEN Dr. C_year_month='2007-06' THEN a. d. _total_money ELSE NULL END), the AS/2007-06,
SUM (CASE WHEN Dr. C_year_month='the 2007-07' THEN a. d. _total_money ELSE NULL END), the AS/2007-07,
The SUM (CASE WHEN Dr. C_year_month='2007-08' THEN a. d. _total_money ELSE NULL END) AS [in the 2007-08],
SUM (CASE WHEN Dr. C_year_month="2007-09 'THEN a. d. _total_money ELSE NULL END), the AS/2007-09,
The SUM (CASE WHEN Dr. C_year_month='2007-10 "' THEN a. d. _total_money ELSE NULL END) AS [2007-10],
The SUM (CASE WHEN Dr. C_year_month='2007-11' THEN a. d. _total_money ELSE NULL END) AS (2007-11),
SUM (CASE WHEN Dr. C_year_month='2007-12 "' THEN a. d. _total_money ELSE NULL END), the AS/2007-12
The From v_customer_monthcost_view AS A,
CD_CUSTOMER AS B
Where Anderson _CUSTOMER_ID=B.I _CUSTOMER_ID AND
Anderson _CUSTOMER_ID=847 AND Dr. C_year='2007', '
Group By B.V C_CUSTOMER_NAME,
Dr. C_company,
Dr. C_card_no,
Dr. C_tel '


End

PB in the following called
String ls_Sql;

Ls_Sql=Space (2000);
DECLARE lpro_test PROCEDURE FOR spc_test @ STRSQL=: ls_sql OUTPUT;
The SQLCA. The AutoCommit=TRUE
The EXECUTE lpro_test;
The SQLCA. The AutoCommit=FALSE
The Fetch lpro_test INTO: ls_sql;

Why call ls_sql value be intercepted?

CodePudding user response:

Stored procedure defined in 8000, isn't it?
Define only 2000 outside

CodePudding user response:

It doesn't matter! Because I am defined type String

CodePudding user response:

guanzhu

CodePudding user response:

String ls_Sql;

DECLARE lpro_test PROCEDURE FOR spc_test @ STRSQL=: ls_sql OUTPUT;

The EXECUTE lpro_test;

The Fetch lpro_test INTO: ls_sql;

CodePudding user response:

Focus on..

CodePudding user response:

I also come across this problem, an obsession for a long time, then observed, in pb, even when you are stating the output parameter is a string type, and only 255, but the length of the longest, I was using a PB8
  • Related