PHP calls Oracle stored Procedure Code (1/3)

Source: Internet
Author: User
Tags php and php code

/*
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

Home 1 2 3 last
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.