OCI8 Stored Procedure and Functions
| From: | Fred Bulah | Date: | Fri, 16 Jun 2000 22:28:38 +0000 |
| Subject: | OCI8 Stored Procedure and Functions | ||
| References: | 1 2 3 4 5 6 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-447@lists.php.net to get a copy of this message | ||
I've defined a package that contains the following type, function and procedure:
TYPE CustAcct IS RECORD
(
customerId NUMBER,
accountId NUMBER
);
PROCEDURE isRegisteredP( userId IN VARCHAR2,
ca_rec OUT CustAcct)
IS
u_id VARCHAR2(32);
BEGIN
u_id := userId;
SELECT customerId, accountId INTO ca_rec FROM Customer WHERE userId = u_id;
END isRegisteredP;
FUNCTION isRegisteredF( userId IN VARCHAR2) return Customer%ROWTYPE
IS
u_id VARCHAR2(32);
customerRec Customer%ROWTYPE;
BEGIN
u_id := userId;
SELECT * INTO customerRec FROM Customer WHERE userId = u_id;
return( customerRec );
END isRegisteredF;
Questions:
- How do you execute a function in a package from OCIExecute()? Part of the problem
is setting up the variable to store the return value which in this case is a record
defined as the ROWTYPE of a table.
- How do you execute a stored procedure that executes a select that has an output
parameter declared as a table ROWTYPE or user-defined type ? The issue here is the
binding to the output parameter.