having trouble getting a ref cursor from a oracle 9i database


2005-04-26 09:45:31 PM
cppbuilder96
im having trouble getting a ref cursor from a oracle 9i database. heres my
bcb6 code... i know im connecting fine to the database, and also being able
to find the stored procedure on the server, but get that refcursor out of
the package procedure is my problem....
void __fastcall TForm1::Button1Click(TObject *Sender)
{
//Setup Database1
Database1->DatabaseName = Edit1->Text;
Database1->AliasName = Edit2->Text;
//Setup Query
Query1->DatabaseName = Edit1->Text;
//Setup Stored Procedure
StoredProc1->DatabaseName = Edit1->Text;
StoredProc1->StoredProcName = Edit4->Text;
StoredProc1->Params->CreateParam(ftCursor, "o_csResults", ptOutput);
try{
StoredProc1->Prepare();
StoredProc1->Open();
}
catch(const EDatabaseError &E){
Database1->Close();
ShowMessage(E.Message); //E.Message = 'operation not applicable'
}
}
Heres my package procedure:
create or replace package testGet as
TYPE refCurResults IS REF CURSOR;
PROCEDURE GetResults(csResults IN OUT testGet.refCurResults);
end testGet;
create or replace package body testGet as
PROCEDURE GetResults(csResults IN OUT testGet.refCurResults) IS
BEGIN
OPEN csResults FOR
select * from data1;
CLOSE csResults;
INSERT into data1 values('Tag 9', 666, to_date('2/3/3 10:23:21', 'mm/dd/yyyy
hh:mi:ss'), 1, 1, 'testHIT WORKED');
commit;
END GetResults;
end testGet;