English 中文(简体)
如何将记录表作为附件通过Oracle存储程序
原标题:How to pass a table of records as a parameter to an Oracle Stored procedure

我有一个贮存程序,接受记录表作为其投入参数:

TYPE JREC is record
(
CUSTOMERID COMPANYS.COMPANYID%TYPE ,
JOBID JOBS.JOBID%TYPE,    
-----   
);

TYPE TJOBLIST IS TABLE OF JREC  INDEX BY BINARY_INTEGER;    

PROCEDURE UPDATEJOBS(JRECS IN TJOBLIST )
IS
 BEGIN
     FOR i IN JRECS .FIRST .. JRECS .LAST LOOP
-----PROCEDURE BODY---

Please let me know how can I call this procedure from Delphi. I am using RAD Studio 2007

问题回答

You can call as this example:

DECLARE
  L_TABLE TJOBLIST ;
  NCOUNT PLS_INTEGER;
BEGIN

  L_TABLE := TJOBLIST(); --Create table
  L_TABLE.extend; --Add an element
  NCOUNT := L_TABLE.COUNT();
  L_TABLE(NCOUNT).CUSTOMERID := 1;
  L_TABLE(NCOUNT).JOBID := 10;
  L_TABLE.extend; --Add another element
  NCOUNT := L_TABLE.COUNT();
  L_TABLE(NCOUNT).CUSTOMERID := 2;
  L_TABLE(NCOUNT).JOBID := 20;
  L_TABLE.extend; --Add another element
  NCOUNT := L_TABLE.COUNT();
  L_TABLE(NCOUNT).CUSTOMERID := 3;
  L_TABLE(NCOUNT).JOBID  := 30;
  --.. and so on

  --Call the procedure and pass the table as a parameter
  UPDATEJOBS(L_TABLE);
END;




相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签