没有合适的资源?快使用搜索试试~ 我知道了~
首页proc开发指南(C使用SQL,oracle)
proc开发指南(C使用SQL,oracle)

proc开发指南,书 Pro*C/C++ Precompiler Programmer’s Guide Release 8.1.6
资源详情
资源评论
资源推荐

Pro*C/C++ Precompiler
Programmer’s Guide
Release 8.1.6
December 1999
Part No. A76942-01

Pro*C/C++ Precompiler Programmer’s Guide, Release 8.1.6
Part No. A76942-01
Copyright © 1996, 1999, Oracle Corporation. All rights reserved.
Primary Authors: Jack Melnick, Tom Portfolio, Tim Smith
Contributing Authors: Ruth Baylis, Paul Lane
Contributors: Bill Bailey, Julie Basu, Brian Becker, Beethoven Cheng, Michael Chiocca, Pierre Dufour,
Nancy Ikeda, Alex Keh, Thomas Kurian, Shiao-Yen Lin, Vidya Nagaraj, Jacqui Pons, Ajay Popat,
Ekkehard Rohwedder, Pamela Rothman, Alan Thiesen, Gael Stevens
Graphic Designer: Valarie Moore
The Programs (which include both the software and documentation) contain proprietary information of
Oracle Corporation; they are provided under a license agreement containing restrictions on use and
disclosure and are also protected by copyright, patent, and other intellectual and industrial property
laws. Reverse engineering, disassembly, or decompilation of the Programs is prohibited.
The information contained in this document is subject to change without notice. If you find any problems
in the documentation, please report them to us in writing. Oracle Corporation does not warrant that this
document is error free. Except as may be expressly permitted in your license agreement for these
Programs, no part of these Programs may be reproduced or transmitted in any form or by any means,
electronic or mechanical, for any purpose, without the express written permission of Oracle Corporation.
If the Programs are delivered to the U.S. Government or anyone licensing or using the programs on
behalf of the U.S. Government, the following notice is applicable:
Restricted Rights Notice Programs delivered subject to the DOD FAR Supplement are "commercial
computer software" and use, duplication, and disclosure of the Programs, including documentation,
shall be subject to the licensing restrictions set forth in the applicable Oracle license agreement.
Otherwise, Programs delivered subject to the Federal Acquisition Regulations are "restricted computer
software" and use, duplication, and disclosure of the Programs shall be subject to the restrictions in FAR
52.227-19, Commercial Computer Software - Restricted Rights (June, 1987). Oracle Corporation, 500
Oracle Parkway, Redwood City, CA 94065.
The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently
dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup,
redundancy, and other measures to ensure the safe use of such applications if the Programs are used for
such purposes, and Oracle Corporation disclaims liability for any damages caused by such use of the
Programs.
Oracle is a registered trademark, and Pro*COBOL, SQL*Forms, SQL*Net, and SQL*Plus, Net8, Oracle
Call Interface, Oracle7, Oracle7 Server, Oracle8, Oracle8 Server, Oracle8i, Oracle Forms, PL/SQL, Pro*C,
Pro*C/C++, and Trusted Oracle are registered trademarks or trademarks of Oracle Corporation All other
company or product names mentioned are used for identification purposes only and may be trademarks
of their respective owners.

iii
Contents
Send Us Your Comments............................................................................................................... xxix
Preface........................................................................................................................................................ xxxi
What This Guide Has to Offer....................................................................................................... xxxii
Who Should Read This Guide? ..................................................................................................... xxxii
How the Pro*C/C++ Guide Is Organized..................................................................................... xxxii
Conventions Used in This Guide................................................................................................. xxxvi
BNF Notation ............................................................................................................................. xxxvi
ANSI/ISO Compliance ................................................................................................................... xxxvi
Requirements ............................................................................................................................. xxxvi
Does the Oracle Pro*C/C++ Precompiler Meet Industry Standards?.............................. xxxvii
Compliance............................................................................................................................... xxxviii
Certification.............................................................................................................................. xxxviii
FIPS Flagger.............................................................................................................................. xxxviii
Migrating an Application from Earlier Releases................................................................... xxxix
Your Comments Are Welcome...................................................................................................... xxxix
1 Introduction
What Is an Oracle Precompiler?....................................................................................................... 1-2
Why Use the Oracle Pro*C/C++ Precompiler?.............................................................................. 1-3
Why Use SQL?..................................................................................................................................... 1-3
Why Use PL/SQL?............................................................................................................................... 1-4
What Does the Pro*C/C++ Precompiler Offer?............................................................................. 1-4
Frequently Asked Questions............................................................................................................ 1-7

iv
What’s a VARCHAR? .................................................................................................................. 1-7
Does Pro*C/C++ Generate Calls to the Oracle Call Interface?.............................................. 1-7
Then Why Not Just Code Using SQLLIB Calls, and Not Use Pro*C/C++?......................... 1-7
Can I Call A Pl/SQL Stored Procedure From a Pro*C/C++ Program?................................ 1-8
Can I Write C++ Code, and Precompile It Using Pro*C/C++? ............................................ 1-8
Can I Use Bind Variables Anyplace in a SQL Statement? ...................................................... 1-8
I Am Confused By Character Handling in Pro*C/C++.......................................................... 1-8
What About Character Pointers? Is There Anything Special About Them?........................ 1-9
Why Doesn’t SPOOLWork in Pro*C/C++?.............................................................................. 1-9
Where Can I Find The On-line Versions of the Sample Programs?...................................... 1-9
How Can I Compile and Link My Application?...................................................................... 1-9
Does Pro*C/C++ Now Support Using Structures As Host Variables?................................ 1-9
Is It Possible to Have Recursive Functions In Pro*C/C++, If I Use Embedded SQL In the
Function? 1-10
Can I Use Any Release of Pro*C/C++ with Any Version of the Oracle Server?............... 1-10
When My Application Runs Under Oracle8i, I Keep Getting an Ora-1405 Error (Fetched
Column Value Is NULL). 1-10
Are All SQLLIB Functions Private? ......................................................................................... 1-10
How Does Oracle8i Support The New Object Types? .......................................................... 1-12
2 Precompiler Concepts
Key Concepts of Embedded SQL Programming ......................................................................... 2-2
Embedded SQL Statements ........................................................................................................ 2-2
Embedded SQL Syntax ................................................................................................................ 2-4
Static Versus Dynamic SQL Statements .................................................................................... 2-5
Embedded PL/SQL Blocks ........................................................................................................ 2-5
Host and Indicator Variables ...................................................................................................... 2-5
Oracle Datatypes........................................................................................................................... 2-6
Arrays............................................................................................................................................. 2-6
Datatype Equivalencing............................................................................................................... 2-7
Private SQL Areas, Cursors, and Active Sets ........................................................................... 2-7
Transactions................................................................................................................................... 2-7
Errors and Warnings.................................................................................................................... 2-8
Steps in Developing an Embedded SQL Application................................................................. 2-8
Programming Guidelines................................................................................................................ 2-10

v
Comments ................................................................................................................................... 2-10
Constants ..................................................................................................................................... 2-10
Declare Section............................................................................................................................ 2-10
Delimiters..................................................................................................................................... 2-11
File Length................................................................................................................................... 2-12
Function Prototyping................................................................................................................. 2-12
Host Variable Names................................................................................................................. 2-13
Line Continuation....................................................................................................................... 2-13
Line Length.................................................................................................................................. 2-13
MAXLITERAL Default Value................................................................................................... 2-13
Operators ..................................................................................................................................... 2-14
Statement Terminator ................................................................................................................ 2-14
Conditional Precompilations.......................................................................................................... 2-14
Defining Symbols ....................................................................................................................... 2-15
An Example................................................................................................................................. 2-15
Precompiling Separately ................................................................................................................. 2-16
Guidelines.................................................................................................................................... 2-16
Compiling and Linking................................................................................................................... 2-17
Sample Tables ................................................................................................................................... 2-17
Sample Data................................................................................................................................. 2-18
Sample Program: A Simple Query................................................................................................ 2-18
3 Database Concepts
Connecting to the Database.............................................................................................................. 3-2
Using the ALTER AUTHORIZATION Clause to Change Passwords ................................. 3-3
Connecting Using Net8 ............................................................................................................... 3-4
Automatic Connects..................................................................................................................... 3-4
Advanced Connection Options........................................................................................................ 3-6
Some Preliminaries....................................................................................................................... 3-6
Concurrent Logons....................................................................................................................... 3-6
Default Databases and Connections.......................................................................................... 3-7
Explicit Connections..................................................................................................................... 3-8
Implicit Connections.................................................................................................................. 3-14
Definitions of Transactions Terms................................................................................................ 3-15
How Transactions Guard Your Database..................................................................................... 3-16
剩余913页未读,继续阅读











安全验证
文档复制为VIP权益,开通VIP直接复制

评论2