Stored Procedure for calling oracle in VFP

Source: Internet
Author: User

Source: Network/Editor: getting started with programming: Unknown

Because of its popularity and ease of use, VFP is well received by developers, but its security and stability are not perfect. In this regard, Oracle
The advantage is that they are well-known and can be combined to develop efficient, secure, and stable application systems. The following is a simple example of calling the Oracle Stored Procedure Method in VFP.
Hope to play a role in attracting others. This method is applicable to the c/s development method that uses VFP as the front-end development tool and Oracle as the back-end database.

On the Oracle side, the following tables and stored procedures are built:

The gzb table is as follows:

   SQL〉select * from gzb; ID
   GZ
   1
   3050
   3
   2500
   2
   4000.8

The stored procedure is as follows:

     create or replace procedure p_update—gzb (p—id in number, p—gz in number) as
     begin
     update gzb set gz=p—gz where id=p—id;
     commit;
     end;

On the frontend (VFP end), assume that the connection with Oracle is established 'vfplink '(for detailed steps, refer to the help documentation of VFP ):

Open link:

Nhand = sqlconnect ('vfplink ′)

& Nhand is the returned link handle

Call the Oracle Stored Procedure p-Update-gzb:

This stored procedure has two parameters: ID and GZ. If we set the GZ value of the employee whose ID is 2 to 5000, we can execute:

Sqlexec (nhand, "{call p-Update-gzb (2,5000 )}″)

If the execution is successful, 1 is returned, and-1 is returned if the execution fails. Run the following command to verify whether the stored procedure has been successfully executed:

Sqlexec (nhand, 'select * From gzb ′)

Brow

The result is:

ID GZ
1 3050
3 2500
2 5000

It can be seen that the Oracle Stored Procedure p-Update-gzb has been successfully executed. Finally, do not forget to disconnect:

Disconnect (nhand)

The preceding example is run in VFP6.0 and Oracle 7.3.3 environments.

 

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.