Home > database >  The ORACLE stored procedure output
The ORACLE stored procedure output

Time:10-07

The create PROC ZDY_QLCXB
(@ LSBH VARCHAR (20))
AS
The begin
The SELECT KCXED1_SJDH FROM KCXED1 WHERE KCXED1_LSBH=@ LSBH)
End
In SQL to create as a stored procedure, then run the stored procedure, can direct access to the results
The EXEC ZDY_QLCXB '6'
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Above the stored procedures to implement SQL in ORACLE as output effect?

CodePudding user response:

Oracle stored procedure can't achieve your requirement,

Two methods around the

1, change function

Type 2, use output parameters, that is, the out,

CodePudding user response:

The
refer to the original poster oHaiBin123456 response:
create PROC ZDY_QLCXB
(@ LSBH VARCHAR (20))
AS
The begin
The SELECT KCXED1_SJDH FROM KCXED1 WHERE KCXED1_LSBH=@ LSBH)
End
In SQL to create as a stored procedure, then run the stored procedure, can direct access to the results
The EXEC ZDY_QLCXB '6'
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Above the stored procedures to implement SQL in ORACLE as output effect?


This is the grammar of the MSSQL database, oracle, in addition to the above fruits bro, you can also be printed by dbms_output package, for example:
Create procedure ZDY_QLCXB (LSBH VARCHAR (20))
AS
V_sjdh varchar (100);
The begin
The SELECT KCXED1_SJDH into v_sjdh FROM KCXED1 WHERE KCXED1_LSBH=LSBH);
dbms_output. Put_line (v_sjdh);
end;


Up sqlplus username/password @ tnsname
SQL> set serveroutput on
SQL> The exec ZDY_QLCXB;

  • Related