Home > Back-end >  BCB call the Oracle stored procedure
BCB call the Oracle stored procedure

Time:10-11

Ask next
 
- a table
The CREATE TABLE Book
(
ID NUMBER (10) NOT NULL, PRIMARY KEY,
Chinese_Name varchar (200),
Englist_Name varchar (200)
)
- a stored procedure
The create or replace procedure query_BOOK (bookID OUT IN NUMBER, MY_BOOK OUT VARCHAR2, MY_BOOK2 OUT VARCHAR2) is
The begin
Select ID, Chinese_Name Englist_Name INTO bookID, MY_BOOK, MY_BOOK2 from BOOK where ID=bookID;
End query_BOOK;


I how to use ADOQUERY in BCB query information? This is no good, invalid SQL statements, should be how to write

 
Void __fastcall TForm1: : Button1Click (TObject * Sender)
{
Int ID;
Strings str1;
String str2;

ADOQuery1 - & gt; Close();
ADOQuery1 - & gt; SQL - & gt; The Clear ();
ADOQuery1 - & gt; SQL - & gt; Add (" query_BOOK 1, str1, str2 ");
ADOQuery1 - & gt; The Open ();
ADOQuery1 - & gt; The First ();
ID=ADOQuery1 - & gt; FieldByName (" ID ") - & gt; AsInteger;
ShowMessage (ID);
}



CodePudding user response:

Come to see it

CodePudding user response:

ADOQuery1 - & gt; SQL - & gt; Add (" select * from the book ");
Why this is wrong prompt table or view there is no
I can find out and up sqlplus in PLSQL data should be set to the dba mode but adoconnection when connect to the database how to set the dba mode

CodePudding user response:

Write to you about the code, the need to debug,
 ADOQuery1 - & gt; Close(); 
ADOQuery1 - & gt; SQL - & gt; The Clear ();

String strSQL=String (). Sprintf (
The TEXT (" exec query_BOOK ")
The TEXT (" @ bookID=: bookID OUTPUT, ")
The TEXT (" @ MY_BOOK=: MY_BOOK OUTPUT, ")
The TEXT (" @ MY_BOOK2=: MY_BOOK2 OUTPUT "));

ADOQuery1 - & gt; SQL - & gt; Text=strSQL;

Int nBookID=123; Attach a monetary value//
Strings str1 str2;
ADOQuery1 - & gt; The Parameters - & gt; The Items [0] - & gt; Value=https://bbs.csdn.net/topics/nBookID;
ADOQuery1 - & gt; The Parameters - & gt; The Items [1] - & gt; Value=https://bbs.csdn.net/topics/str1;
ADOQuery1 - & gt; The Parameters - & gt; The Items [2] - & gt; Value=https://bbs.csdn.net/topics/str2;

Try
{
ADOQuery1 - & gt; The Open ();

For (int I=0; i {
Str1=ADOQuery1 - & gt; The Parameters - & gt; The Items [1] - & gt; The Value;
Str2=ADOQuery1 - & gt; The Parameters - & gt; The Items [2] - & gt; The Value;

.

ADOQuery1 - & gt; The Next ();
}
}
The catch (... )
{
//query_BOOK stored procedure execution error!
}

CodePudding user response:

I am relieved to demon elder brother,

CodePudding user response:

Focus on

CodePudding user response:

Over, over the past 15 months, the original poster is not knot, dared ask the original poster is it ok?

CodePudding user response:

The building Lord xianyou
  • Related