A stored procedure called Oracle in VFP

Source: Internet
Author: User

VFP because of its popularity, ease of use, by the vast number of developers welcome, but its security and stability is not very perfect. The advantages of Oracle in this respect are legendary, the combination of both, can develop efficient, safe and stable application system. There is less information on how to invoke Oracle stored procedures in VFP, and here's a simple example of this, hoping to play a role. This method is suitable for the development of C/s method using VFP as front-end development tool and Oracle as back-end database.

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

Table Gzb 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;

At the front end (VFP end), assume that you have established a link with Oracle ′vfplink′ (the specific steps can refer to VFP's help documentation):

To open a link:

Nhand=sqlconnect (′vfplink′)

&&nhand for the returned link handle

Call Oracle's stored procedure P-UPDATE-GZB:

This stored procedure has two parameters, respectively, ID and GZ, we set to update the employee ID 2 of GZ to 5000, you can perform:

SqlExec (Nhand, ″{call p-update-gzb (2,5000)}″)

If the execution succeeds, it returns 1, and the failure returns-1. We can execute the following command to verify that the stored procedure was executed successfully:

SqlExec (Nhand,′select * from gzb′)

Brow

The result:

Id GZ
1 3050
3 2500
2 5000

Visible, Oracle's stored procedure P-UPDATE-GZB has been successfully executed, and finally, don't forget to disconnect:

Disconnect (Nhand)

The above example runs through the VFP6.0, Oracle 7.3.3 environment.

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.