/*
Speed and efficiency. The speed of using stored procedures is obviously faster. In efficiency, if you need to do a series of SQL operations, you need to go back and forth between PHP and Oracle, it is better to put the application directly to the database tutorial to reduce the number of round-trip, increase efficiency. But in Internet applications, speed is extremely important, so it is necessary to use stored procedures
*/
Create a test table
CREATE TABLE Test (
ID number is not NULL,
Name VARCHAR2 NOT NULL,
Primary KEY (ID)
);
Insert a piece of data
INSERT into test values (5, ' Php/index.html>php_book ');
Establish a stored procedure
Create or replace procedure Proc_test (
P_ID in Out number,
P_name out VARCHAR2
) as
Begin
Select name into P_name
From Test
where id = 5;
End Proc_test;
/
--------------------------------------------------------------------------------
php/index.html>php Code:--------------------------------------------------------------------------------
Establishing a database connection
$user = "Scott"; Database user Name
$password = "Tiger"; Password
$conn _str = "Tnsname"; Connection string (cstr:connection_string)
$remote = TRUE//Whether remote connection