Usually used to MS-SQL2000, Meng a use of Oracle is really a little uncomfortable. Today, I wrote a query statement. After writing it, I found it was too long. In terms of performance and convenience, it is decided to pass it to the stored procedure for implementation. The idea is there, but I really don't know how to write it on Oracle! (Oracle syntax manuals have not yet been practically studied. They are all used in rare cases !)
First, imitate the existing stored procedure to add its syntax structure.
The format is as follows:
Create Or Replace ProcedureSp_zy_hzqdyl (
V_inpatient_idIn Number,
)Is
Begin
Select * from a where c =V_inpatient_id
End
Haha !! Finished! PL/SQL Execution, Error!
What's going on !!
Later, I asked my colleagues to understand that the cursor should be used to query data in Oracle!
Create Or Replace ProcedureSp_zy_hzqdyl (
V_inpatient_idIn Number,
C_curOutPa_zy.c_zy
)Is
Begin
OpenC_curFor
Select * from a where c =V_inpatient_id
End
Executed in PL/SQL. Successful!
I learned some basic knowledge today!