PL/SQL Procedure guidelines

I need to load the records from one table and insert and/or update it into different tables based on the column values. If any one has any template or guidelines for doing similar tasks, it would be give me a proper refernce. This is what I came up with based on the reading and other online examples. My concerns are about memory, commit & rollback points and performances. If anyone could point out any potential problems or any better ways of doing it, it would be greatly appreciated. There would be 30-40,000 records per day and this procedure is scheduled to run every evening. Please bear with me for this lengthy post.
--@test_pkg.sql;
--exec test_pkg.load_records(200);
create or replace package test_pkg
is
procedure load_records (fetch_limit in number := 200, log_lvl in number := 4);
procedure new_record (retKey out number);
procedure update_record(recKey in number);
procedure ins_upd_attribute (id1 in number, id2 in char, id3 in number, val in varchar2);
procedure log_msg(msg_type in number := 0, msg in varchar2);
function get_fk (col5 in varchar2) return number;
end test_pkg;
create or replace package body test_pkg
is
cursor test_cur
is
select col1, col2, col3, col4, col5,col6, name, phone, address1, city, state, zip, birthdate,
email, col7,lastdate, process_flag
from table1
where process_flag = 'N' for update of process_flag;
type test_cur_type is table of test_cur%rowtype;
cur_rec test_cur_type;
LOG_OFF number := 0;
LOG_FATAL number := 1;
LOG_ERROR number := 2;
LOG_WARNING number := 3;
LOG_INFO number := 4;
LOG_DEBUG number := 5;
log_level number := LOG_INFO;
i number := 1;
last_change_user number := 261;
last_change_date date; /* Sysdate */
rec_num, new_rec_count, error_record_count, total_record_count number;
start_time, end_time, processing_time number;
procedure load_records (fetch_limit in number := 200, log_lvl in number := 4)
is
begin
log_level := log_lvl;
start_time := dbms_utility.get_time;
log_msg(LOG_INFO, start_time||':test_pkg.load_records procedure started...');
select sysdate into last_change_date from dual;
new_rec_count := 0;
col2_count := 0;
col3_count := 0;
col4_count := 0;
attr_records_added := 0;
attr_records_updated := 0;
error_record_count := 0;
total_record_count := 0;
end_time := 0;
processing_time := 0;
open test_cur;
loop
fetch test_cur bulk collect into cur_rec limit fetch_limit;
for i in 1..cur_rec.count
loop
rec_num := 0;
if ((cur_rec(i).col5 > 0) and
(cur_rec(i).col1 = 'Y') or
(cur_rec(i).col2 = 'Y') or
(cur_rec(i).col3 = 'Y') or
(cur_rec(i).col4 = 'Y'))
then
if cur_rec(i).col1 = 'Y' then
new_record(rec_num);
else
rec_num := get_fk(cur_rec(i).col5);
end if;
log_msg(LOG_DEBUG, 'col5<'||cur_rec(i).col5||'> rec_num<'||rec_num||'>');
if rec_num <= 0 then
log_msg(LOG_INFO, 'Invalid record. rec#<'||cur_rec(i).col5||'> cx<'||rec_num||'>. No matching record found in card table');
else
if cur_rec(i).col2 = 'Y' then
ins_upd_attribute(rec_num, 'C', 191, 'Y');
end if;
if cur_rec(i).col3 = 'Y' then
ins_upd_attribute(rec_num, 'C', 192, 'Y');
end if;
if cur_rec(i).col4 = 'Y' then
ins_upd_attribute(rec_num, 'P', 193, 'Test');
end if;
if cur_rec(i).col6 = 'Y' then
update_record(cur_rec(i).col5);
end if;
end if;
else
log_msg(LOG_INFO, cur_rec(i).col5||' is an invalid record...No options selected.');
error_record_count := error_record_count + 1;
end if;
total_record_count := total_record_count + 1;
end loop;
exit when test_cur%notfound;
end loop;
close test_cur;
commit;
end_time := sys.dbms_utility.get_time;
--processing_time := mod (((end_time - start_time) + power(2,32)), power(2,32));
processing_time := end_time - start_time;
log_msg(LOG_INFO, '*********** Execution Summary ***********');
log_msg(LOG_INFO, ' New record requests: ' || new_rec_count);
log_msg(LOG_INFO, ' Invalid option records: ' || error_record_count);
log_msg(LOG_INFO, ' Total records processed: ' || total_record_count);
log_msg(LOG_INFO, ' Total processing time: ' || processing_time || ' ms');
log_msg(LOG_INFO, '*****************************************');
exception
when others then
log_msg(LOG_INFO, 'Other exceptions occured...');
--loghandler.log(sqlcode, sqlerrm,'load_records');
end load_records;
procedure new_record (retKey out number)
is
key1, key2, key3 number;
begin
retKey := 0;
--log_msg(LOG_INFO, start_time||':test_pkg.new_record procedure started...');
select value into key1 from keyTable where parameter = 'KEY1' for update;
update keyTable set value = key1 + 1 where parameter = 'KEY1';
select value into key2 from keyTable where parameter = 'KEY2' for update;
update keyTable set value = key2 + 1 where parameter = 'KEY2';
select value into key3 from keyTable where parameter = 'KEY3' for update;
update keyTable set value = key3 + 1 where parameter = 'KEY3';
log_msg(LOG_DEBUG, 'rec#<'||cur_rec(i).col4||'> key1<'||key1||'> key2<'||key2||'> key3<'||key3||'>');
insert into table1 (col1, col2, col3, col4, rectype, lastchangedate, lastchangeuserid)
values (key1, key2, key3, cur_rec(i).col4,'Unknown',last_change_date,last_change_user);
log_msg(LOG_DEBUG, 'Table1 record inseted...');
insert into table2 (col1, col2, col3, col4)
values(key2, key3, key1, cur_rec(i).name);
log_msg(LOG_DEBUG, 'Table2 record inseted...');
insert into table3 (col1, col2, col3, phone, addr, postalcode, lastchangedate, lastchangeuserid)
values (key3, key1, key2, cur_rec(i).phone, cur_rec(i).address1, cur_rec(i).zip, last_change_date,last_change_user);
log_msg(LOG_DEBUG, 'Table3 record inseted...');
retKey := key1;
new_rec_count := new_rec_count + 1;
exception
when others then
log_msg(LOG_INFO, 'Other exceptions occured...sqlcode: '||sqlcode||' sqlerrm: '|| sqlerrm);
end new_record;
procedure ins_upd_attribute (id1 in number, id2 in char, id3 in number, val in varchar2) is
record_count number := 0;
begin
log_msg(LOG_DEBUG, start_time||':test_pkg.ins_upd_attribute procedure started...');
select count(1) into record_count from attributeTable where col1 = id1 and col2 = id2 and col3 = id3;
if record_count = 1
then
update attributeTable set value = val where col1 = id1 and col2 = id2 and col3 = id3;
attr_records_updated := attr_records_updated + 1;
else
insert into attributeTable(col1,col2,col3,value ) values(id1,id2,id3,val);
attr_records_added := attr_records_added + 1;
end if;
exception
when others then
log_msg(LOG_INFO, 'Other exceptions occured...sqlcode: '||sqlcode||' sqlerrm: '|| sqlerrm);
end ins_upd_attribute;
procedure update_record (recKey in number) is
id1 number := 0;
begin
log_msg(LOG_DEBUG, start_time||':test_pkg.update_record procedure started...');
select col4 into id1 from table1 where col1 = recKey;
if id1 > 1
then
update tabl3 set phone = cur_rec(i).phone,
addr = cur_rec(i).address1, postalcode =cur_rec(i).zip where id =id1;
end if;
exception
when others then
log_msg(LOG_INFO, 'Other exceptions occured...sqlcode: '||sqlcode||' sqlerrm: '|| sqlerrm);
end update_record;
function get_fk (recKey in varchar2) return number is
rec_num number := 0;
begin
select key4 into rec_num from table1 where col4 = recKey;
return rec_num;
exception
when no_data_found then
log_msg(LOG_INFO, 'No Data found exceptions occured...recKey<'||recKey||'>');
when others then
log_msg(LOG_INFO, 'Other exceptions occured...sqlcode: '||sqlcode||' sqlerrm: '|| sqlerrm);
end get_fk;
procedure log_msg(msg_type in number := 0, msg in varchar2) is
begin
if msg_type <= log_level
then
log_msg(LOG_DEBUG, start_time||':test_pkg.ins_upd_attribute procedure started...');
--loghandler.log(sqlcode, sqlerrm,'load_records')
end if;
exception
when others then
log_msg(LOG_INFO, 'Other exceptions occured...sqlcode: '||sqlcode||' sqlerrm: '|| sqlerrm);
end log_msg;
end test_pkg;
/

Thanks for your reply. No. I can not use insert into or merge into options. My scenario is like this.
Read the staging table records where processed_flag is 'N'
if (col1 !='Y' and col2 !='Y' or col3 !='Y' or col4 !='Y') and col5 = 0 then
log this record. goto the next record.
else
if col1 = 'Y' then
rec_key = new_record(rec_num);
else
rec_key = get_fk(col5);
end if;
if col2 = 'Y' then
ins_upd_attribute(rec_key,'C', 191, 'Y');
end if;
if col3 = 'Y' then
ins_upd_attribute(rec_key,'C', 192, 'Y');
end if;
if col4 = 'Y' then
ins_upd_attribute(rec_key,'P', 193, 'Test');
end if;
if col6 = 'Y' then
update_record(col5);
end if;
update the processed flag to 'Y';
end if;
procedure new_record(retKey out number) is
Select the next values for 3 keys from keyTable. update keyTable column values with +1.
Insert new records into table1, table2 and table3
end new_record;
procedure ins_upd_attribute (id1 in number, id2 in char, id3 in number, val in varchar2) is
if a record exists in attributeTable then
update the attributeTable record
else
insert new record into attributeTable.
end if;
end ins_upd_attribute;
function get_fk (recKey in varchar2) return number is
if a record exist in table1 then
return record key
else
return 0;
end if;
end get_fk;
procedure update_record (recKey in number) is
if a record exists in table1 then
update table3 using the key from table1
end if;
end update_record;
Should I commit after processing each record in the staging table or commit after processing all records?
Should I combine all procedures and functions into one large procedure (load_records) or leave it the way it is now? Does any one see any potential problems with my current approach? Any advice will be sincerely appreciated.
Message was edited by:
new2sql

Similar Messages

  • Pl/sql procedure to validate/review

    Hi folks, looking for some good practice/guidelines for evaluating and reviewing a big pl/sql procedure performance, have already tried dbms_profiler ... but not good, would like to hear ... is there any other/better option to work with.
    Regards

    Alvaro wrote:
    Run them in development see if the performance will be acceptable, if not then you can do a TRACE/TKPROF to drill down to the slowdown.
    After that you can perhaps invoke the SQL tuning facility and proceed to tune the invidual SQL commands individually.
    Don't see any quick way of giving you a large overview of all the performance of all PL/SQLs on the database. This must be done on a case-by-case basis.
    And that is the basic issue. You CANNOT determine performance of the code in production using development. Anyone that says it can be done, has either a perfectly static and known production environment, that is duplicated to the last byte and last h/w bolt on development. Or is a liar.
    So as you need to design, work and test within the limits of development, the aims are simple. Design and write scalable and performant code. No need to be a rocket scientists or analysing tkprof traces to determine whether code is scalable and performant. One should be able to, at first look, tell that a FOR cursor loop doing DMLs inside the loop is not performant and cannot scale. Or that a procedure tasked to update almost every single row in a VLT, is a major workload that is serialised, and instead should be parallelised. So before diving into nuts and bolts of a tkprof, get the algorithms and designs right.
    As for unleashing the code on production. No amount of stress testing and tuning on development is adequate to tick off the deployment checklist box that says "+code will now run just fine in production+". Which is why you need to add to the code, the ability for the code to report on what it is doing, the workloads its dealing with, the resources it has available and is using, and how fast it is dealing with the workloads.
    The success of that s/w deployed to production, directly depends on how well that code is instrumented - in order to enable the code to report on problems encountered in the production environment.

  • Unable to capture the parameter values from a PL/SQL procedure

    hi.
    i'm trying to capture the parameter values of a PL/SQL procedure by calling inside a anonymous block but i'm getting a "reference to uninitialized collection error" ORA-06531.
    Please help me regarding.
    i'm using following block for calling the procedure.
    declare
    err_cd varchar2(1000);
    err_txt VARCHAR2(5000);
    no_of_recs number;
    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
    cntr_var number:=0;
    begin
         rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
         dbms_output.put_line('The error is ' ||err_cd);
         dbms_output.put_line('The error is ' ||err_txt);
         dbms_output.put_line('The cntr is ' ||cntr_var);
         for incr in 1 .. OUT_SIGN_TAB.count
         loop
         cntr_var := cntr_var + 1 ;
    Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN_TAB(incr).txn_type||','||OUT_SIGN_TAB(incr).objid);
    end loop;
    end;
    Error is thrown on "for incr in 1 .. OUT_SIGN_TAB.count" this line
    Following is some related information.
    the 3rd parameter of the procedure is a out parameter. it is a type of a PL/SQL table (SEARCH_SIGN_TAB_TYPE) which is available in database as follows.
    TYPE "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
    TYPE "SEARCH_SIGN_TYPE" AS OBJECT
    (ref_no VARCHAR2(22),
    ciref_no VARCHAR2(352),
    ac_no VARCHAR2(22),
    txn_type VARCHAR2(301),
    objid VARCHAR2(1024))............

    We don't have your rt843pq procedure, but when commenting that line out, everything works:
    SQL> create TYPE "SEARCH_SIGN_TYPE" AS OBJECT
      2  (ref_no VARCHAR2(22),
      3  ciref_no VARCHAR2(352),
      4  ac_no VARCHAR2(22),
      5  txn_type VARCHAR2(301),
      6  objid VARCHAR2(1024))
      7  /
    Type is aangemaakt.
    SQL> create type "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
      2  /
    Type is aangemaakt.
    SQL> declare
      2    err_cd varchar2(1000);
      3    err_txt VARCHAR2(5000);
      4    no_of_recs number;
      5    out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
      6    cntr_var number:=0;
      7  begin
      8    -- rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
      9    dbms_output.put_line('The error is ' ||err_cd);
    10    dbms_output.put_line('The error is ' ||err_txt);
    11    dbms_output.put_line('The cntr is ' ||cntr_var);
    12    for incr in 1 .. OUT_SIGN_TAB.count
    13    loop
    14      cntr_var := cntr_var + 1 ;
    15      Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN
    TAB(incr).txntype||','||OUT_SIGN_TAB(incr).objid);
    16    end loop;
    17  end;
    18  /
    The error is
    The error is
    The cntr is 0
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • How to call a PL/SQL procedure from a Java class?

    Hi,
    I am new to the E-BusinessSuite and I want to develop a Portal with Java Portlets which display and write data from some E-Business databases (e.g. Customer Relationship Management or Human Resource). These data have been defined in the TCA (Trading Community Architecture) data model. I can access this data with PL/SQL API's. The next problem is how to get the data in the Java class. So, how do you call a PL/SQL procedure from a Java program?
    Can anyone let me know how to solve that problem?
    Thanks in advance,
    Chang Si Chou

    Have a look at this example:
    final ApplicationModule am = panelBinding.getApplicationModule();
    try
         final CallableStatement stmt = ((DBTransaction)am.getTransaction()).
                                                                                         createCallableStatement("{? = call some_pck.some_function(?, ?)}", 10);
         stmt.registerOutParameter(1, OracleTypes.VARCHAR);
         stmt.setInt(2, ((oracle.jbo.domain.Number)key.getAttribute(0)).intValue());
         stmt.setString(3, "Test");
         stmt.execute();
         stmt.close();
         return stmt.getString(1);
    catch (Exception ex)
         panelBinding.reportException(ex);
         return null;
    }Hope This Helps

  • How to call a PL/SQL procedure from a xml Data Template

    We have a requirement in which we need to call a pl/sql package.(dot)procedure from a Data Template of XML Publisher.
    we have registered a Data Template & a RTF Template in the XML Publisher Responsibility in the Oracle 11.5.10 instance(Front End).
    In the Data Query part of the Data Template , we have to get the data from a Custom View.
    This view needs to be populated by a PL/SQL procedure.And this procedure needs to be called from this Data Template only.
    Can anybody suggest the solution.
    Thanks,
    Sachin

    Call the procecure in the After Parameter Form trigger, which can be scripted in the Data Template.
    BTW, there is a specialized XML Publisher forum:
    BI Publisher

  • How to call a PL/SQL procedure from Portal

    Env.Info: Windows NT Server 4 (Service Pack 3) / Oracle 8i R3 EE / Oracle Portal 3.0 Production.
    I created a new schema "BISAPPS" and created a user with the same name. Ran provsyns.sql script to grant Portal API access. Created a new package under this new schema and compiled it against the database. After that I registered the schema as a portal provider. There were no errors.
    Now I logged into Portal using the account PORTAL30. Refreshed the portlet repository and the new portlets appeared. I added the new portlet to the page. It is displayed successfully.
    New portlet allows the user to enter a bug-number and lets the user to either view or edit. If the user clicks on the button "Edit", it opens a new window and displays the contents from BugDB application. But if the user clicks on "Show", it should display the output generated by a PL/SQL procedure (Owned by the above New Schema - BISAPPS) in a separate window. But instead it is displaying the following error in the separate window:
    bisapps_pkg.buginfo: PROCEDURE DOESN'T EXIST.
    DAD name: PORTAL30
    PROCEDURE : bisapps_pkg.buginfo
    URL : http://host_name:80/pls/portal30/bisapps_pkg.buginfo
    And list of environment variables ....
    Can anyone help me? How can I call a PL/SQL procedure when the button is clicked? Thanks in advance.

    You must grant EXECUTE privilege on your procedure to the PORTAL30_PUBLIC user. If the error still persists, create a PUBLIC synonym for your procedure.

  • How to send a java array to a pl/sql procedure

    Hi,
    This is similar to a post about 6 months ago on retrieving pl/sql tables from a java application but I can't seem to figure out how to use what I learned there to solve this.
    In a java application I have a Long[] array, and in the database I have a pl/sql procedure which takes a numeric in parameter. I currently loop through the array in my java application and call the procedure multiple times. What I'd prefer to do is to be able to pass the entire array to a new procedure which performs the looping internally.
    John
    null

    Kathy,
    Search the archives of this forum and the JDBC forum for the terms STRUCT and ARRAY and you can find some sample code on the JDBC How-To Documents page and the JDBC Samples which can both be accessed from this page:
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/index.html
    Good Luck,
    Avi.

  • How to get data from URL in a PL/SQL procedure

    Hi!<br>
    <br>
    I want to pass values in APEX from a report with a link to a PL/SQL procedure through URL.
    How can I make this?<br>
    <br>
    For example:<br>
    <br>
    I have a report:<br>
    <br>
    select<br>
       id,<br>
       name,<br>
       akt,<br>
       case<br>
          when akt is NULL then '< a href="f?p=&APP_ID.:27:&SESSION.:START_PROCESS" name="test_link" >set< /a >'<br>
       end choice<br>
    from<br>
       USERS;<br>
    <br>
    I want to pass the value "id" in the link ( named "test_link" ) . And want to use this value in a process like this:<br>
    <br>
    DECLARE<br>
       v_user_id NUMBER(10);<br>
    BEGIN<br>
       --I want to read this value from the url<br>
       if :REQUEST='START_PROCESS' then<br>
          v_user_id := ????;<br>
          <br>
          ...<br>
       end if;<br>
    END;<br>
    <br>
    <br>
    Thanks!<br>
    Marton

    Hi,
    1- Create a hidden item P27_USER_ID on page 27
    2- Change your code :
    SELECT ID, NAME, akt,
           CASE
              WHEN akt IS NULL
                 THEN    '< a href="f?p=&APP_ID.:27:&SESSION.:START_PROCESS:NO::P27_USER_ID:'
                      || ID
                      || '" name="test_link" >set< /a >'
           -- refer to f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
           END choice
      FROM users;
       And then
    DECLARE
       v_user_id   NUMBER (10);
    BEGIN
       --I want to read this value from the url
       IF :request = 'START_PROCESS'
       THEN
          v_user_id := :p27_user_id;
           --your code
       END IF;
    END;Hope this helps,
    Grégory

  • How to secure a PL/SQL procedure that is called from the web browser

    If you have ever seen the sample document management application, and tried to download a file that was stored in the system, you are probably familiar with the apex_util.count_click URL that is used to download the file. If you copy that URL and paste it into a new browser, you will not be prompted to login to download the requested file. I'm using SSO with Apex as a partner application. How can I secure a pl/sql procedure like this to redirect to the login page before beginning the download?
    Thanks,
    Kris

    You can use the second method described here:
    http://apex.oracle.com/pls/otn/f?p=31517:15
    You would use an application process instead of pasting the procedure call in the browser. In the case I describe, you don't need to grant execute to public on the download procedure.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • Error when try to call a pl/sql procedure from the .xsql file

    I tried to call a pl/sql procedure like this:
    <?xml version="1.0"?>
    <page connection="omtest5" xmlns:xsql="urn:oracle-xsql">
    <xsql:include-owa>
    sampleowaxml.testone
    </xsql:include-owa>
    </page>
    but I got the following error message:
    <?xml version="1.0" ?>
    - <page>
    - <xsql-error action="xsql:include-owa">
    <statement>declare buf htp.htbuf_arr; param_names owa.vc_arr; param_values owa.vc_arr; rows integer := 32767; outclob CLOB;begin param_names(1) := 'HTTP_COOKIE'; param_values(1) := ''; param_names(2) := 'SERVER_NAME'; param_values(2) := 'mxfang-nt.us.oracle.com'; param_names(3) := 'SERVER_PORT'; param_values(3) := '80'; param_names(4) := 'SCRIPT_NAME'; param_values(4) := '/servlets/oracle.xml.xsql.XSQLServlet'; param_names(5) := 'PATH_INFO'; param_values(5) := '/xsql/test/myproject.xsql'; param_names(6) := 'HTTP_USER_AGENT'; param_values(6) := 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)'; owa.init_cgi_env(6,param_names,param_values); sampleowaxml.testone owa.get_page(buf,rows); dbms_lob.createtemporary(outclob,true,dbms_lob.session); for i in 1..rows loop dbms_lob.writeappend(outclob,length(buf(i)),buf(i)); end loop; ? := outclob; ? := DBMS_LOB.INSTR(outclob,CHR(10)&#0124; &#0124;CHR(10));end;</statement>
    <message>ORA-06550: line 3, column 3: PLS-00103: Encountered the symbol "OWA" when expecting one of the following: := . ( @ % ; The symbol ":=" was substituted for "OWA" to continue.</message>
    </xsql-error>
    - <xsql-error action="xsql:include-owa">
    <message />
    </xsql-error>
    </page>
    This error message is very similiar to the message that Shanthir posted on Jan, 21. I did run the dbmslob.sql, but it doesn't help. Anybody has ideas how to solve it?
    I used the PL/SQL web toolkit provided by OAS4.0.8.1. I believe oracle web agent is replaced by this toolkit.
    Thanks,
    Min
    null

    Hi,
    Glad that somebody else too got this problem. Well, as I had mentioned in my previous posting too, I think there are some procedures in the package, dbms_lob, like the writeappend, createtemporary etc.. which is not found in my dbms_lob.sql file, I am using 8.0.5, but I found these procedures in the 8i, I think it is becos of that.
    By the way if anybody got this solution and got any workaround, please help me too.
    I am still waiting for the solution to that.
    Shanthi

  • How to pass multiple parameters while calling a pl/sql procedure based serv

    Hi,
    I have a pl/sql procedure based service that needs to be invoked from the bpel console for testing purpose. This procedure accepts multiple input values which are of varchar2,boolean and datetime data types. How can I get the bpel console to throw a UI where I can enter these values --in other words where(which file and where) can I specify that these are the input parameters that need to be entered along with their types.
    Thanks for yr help!

    Change the payload of the request 'Process WSDL' message type. Change the element of the payload for the RequestMessage to be 'InputParameters' from the XSD generated by the DB Adapter wizard.
    Edit the payload (Element) - Choose 'Project Schema Files'. Select 'InputParameters' from the XSD.
    You can also change the ResponseMessage by doing the same thing, except that you select 'OutputParameters' from the XSD.

  • Obtaining HTML page by issuing a call from a PL/SQL procedure

    Is there any possibility to obtain HTMLDB -> HTML page from a user defined PL/SQL procedure ?
    For example I build an procedure which calls directly
    flows_010500.wwv_flow.show(null,p_flow_step_id=>'2',p_flow_id=>'104')
    and i try to read the result from htp.showpage, but I get a html response page with a security error.
    Maybe is necessary to initialize other parameters?
    Any help?

    Scott, I have got two pages in an application one is login page the other is welcome page. my login page will be process by store proceduer to validate the user based on users table that I have created on my schema. If the user login with username and password, if they exist on this table I will like to send them to welcome page. but I get http://htmldb.oracle.com/pls/otn/wwv_flow.accept.
    The page cannot be found
    The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
    Please try the following:
    If you typed the page address in the Address bar, make sure that it is spelled correctly.
    Open the htmldb.oracle.com home page, and then look for links to the information you want.
    Click the Back button to try another link.
    Click Search to look for information on the Internet.
    HTTP 404 - File not found
    Internet Explorer
    the procedure is below:
    CREATE OR REPLACE PROCEDURE obj_pls_login_chk(p_UserName IN varchar2
    ,p_Password IN varchar2
    ,Login IN varchar2 ) IS
    l_usr_id number;
    l_url varchar2(2000);
    BEGIN
    l_url := 'http://htmldb.oracle.com/pls/otn/f?';
    select user_id into l_usr_id
    from s_cdm_users
    where upper(username) = upper(p_UserName)
    and upper(Password) = upper(p_Password);
    if l_usr_id is not null then
    l_url := l_url||'p=29921:2:4413779570974471450';
    --wwv_flow.show(null,p_flow_step_id=>'29921',p_flow_id=>'29921:2');
    --htp.print(p_UserName);
    end if;
    EXCEPTION
    when others then
    return;
    END

  • Call an applications 'user exit' from a PL/SQL procedure

    My question is a technical PL/SQL question related to Oracle Applications. I need to call a standard applications 'user exit' from a stored PL/SQL procedure. Can anyone tell me if this is possible and how to do it?
    (i.e. I am attempting to call the AR user exit SALESTAX)
    Thanks,
    Michelle Dodge

    Hi,
    Read this thread, perhaps is there your response :
    Host...
    Nicolas.

  • Creating a CSV file from a pl/sql procedure

    Hi Everyone,
    I would like to know how to write a procedure in pl/sql where i need to check if they are any records in a table say "Table A".
    If they are any records in the "Table A" then we need to write those records in the "Table A" to the CSV file.
    If they are no records then we need to insert a record into the CSV file that "No records are found in "Table A".
    Could anybody please help ?
    Thanks in advance

    see this
    ops$tkyte@8i> create or replace procedure dump_table_to_csv( p_tname in varchar2,
    2 p_dir in varchar2,
    3 p_filename in varchar2 )
    4 is
    5 l_output utl_file.file_type;
    6 l_theCursor integer default dbms_sql.open_cursor;
    7 l_columnValue varchar2(4000);
    8 l_status integer;
    9 l_query varchar2(1000)
    10 default 'select * from ' || p_tname;
    11 l_colCnt number := 0;
    12 l_separator varchar2(1);
    13 l_descTbl dbms_sql.desc_tab;
    14 begin
    15 l_output := utl_file.fopen( p_dir, p_filename, 'w' );
    16 execute immediate 'alter session set nls_date_format=''dd-mon-yyyy hh24:mi:ss''
    17
    18 dbms_sql.parse( l_theCursor, l_query, dbms_sql.native );
    19 dbms_sql.describe_columns( l_theCursor, l_colCnt, l_descTbl );
    20
    21 for i in 1 .. l_colCnt loop
    22 utl_file.put( l_output, l_separator || '"' || l_descTbl(i).col_name || '"'
    23 dbms_sql.define_column( l_theCursor, i, l_columnValue, 4000 );
    24 l_separator := ',';
    25 end loop;
    26 utl_file.new_line( l_output );
    27
    28 l_status := dbms_sql.execute(l_theCursor);
    29
    30 while ( dbms_sql.fetch_rows(l_theCursor) > 0 ) loop
    31 l_separator := '';
    32 for i in 1 .. l_colCnt loop
    33 dbms_sql.column_value( l_theCursor, i, l_columnValue );
    34 utl_file.put( l_output, l_separator || l_columnValue );
    35 l_separator := ',';
    36 end loop;
    37 utl_file.new_line( l_output );
    38 end loop;
    39 dbms_sql.close_cursor(l_theCursor);
    40 utl_file.fclose( l_output );
    41
    42 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    43 exception
    44 when others then
    45 execute immediate 'alter session set nls_date_format=''dd-MON-yy'' ';
    46 raise;
    47 end;
    48 /
    Procedure created.
    ops$tkyte@8i> exec dump_table_to_csv( 'emp', '/tmp', 'tkyte.emp' );
    PL/SQL procedure successfully completed.

  • Execute CDC mappings from a PL/SQL procedure

    Hi,
    I´m using OWB 11.2.0.2 for Linux. I´ve created some CDC mappings to update cubes with changes coming from other tables and cubes (from the tables that implement those cubes with the relational option). The issues are:
    - The CDC mappings run successfully from the OWB (Project Navigator - Start), but I cannot execute them from a procedure in PL/SQL with the following code:
    PROCEDURE "PROC_RUNCDCMAPPINGS" IS
    --inicializar variables aquí
    RetVal NUMBER;
    P_ENV WB_RT_MAPAUDIT.WB_RT_NAME_VALUES;
    -- ventana principal
    BEGIN
    RetVal:= BARIK.CDC_LOAD_CUBO_RECARGA.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_TOR.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_TOAE.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_VIAJES.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_TICKETINCIDENCIA.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBO_LIQMONEDERO.MAIN(P_ENV);
    RetVal:= BARIK.CDC_LOAD_CUBOS_LIQTEMPORALES.MAIN(P_ENV);
    COMMIT;
    END;
    It doesn´t report any error (the value for RetVal after execution is 0), but the cubes are not loaded with changes, and the changes stored in the J$_%tables are not consumed.
    Some of the options that may impact in the mappings are:
    - All the CDC are of Simple type
    - There are more than one subscriber to consume the changes, as for some tables, its changes must feed more than one CDC.
    - All the mappings include only one execution unit per mapping.
    - The integration/load template is the default: DEFAULT_ORACLE_TARGET_CT
    Other question is: As I explained, I need more than one subscriber because same updates must be consumed by different CDC mappings, to load different cubes, but I´ve not been able to assign the subscribers to only the tables associated with them, so all the subscribers are subscribed to all the changes in all the CDC tables, but as many of those subscribers never consume the changes of same tables, in the J$_% tables remains the not consumed records, and I haven´t found the way to purge those tables (other than the delete from J$_), nor to assign the tables with the subscribers (so the subscribers are only subscribed to their interested changes, that will be consumed, so the tables will be emptied after the consumption).
    Any help with these problems will be greatly appreciated.
    Tell me if more info is needed to clarify the situation.
    Best regards,
    Ana

    Hi David,
    Thank you for your reply.
    These mappings are the mappings needed to update the cubes with the changes detected by the CDC system, they are located under the Mapping Templates folder and I´m using code templates for the control of the loading and the integration (the DEFAULT_ORACLE_TARGET_CT) mapping.
    What I need is to execute these mappings within a PL/SQL procedure that will be invoked from different tools.
    I´ve done it for regular mappings (not CDC mappings), and it works. The code is the same as for the CDC ones:
    PROCEDURE "PROC_RUNLOADMAPPINGS" IS
    --inicializar variables aquí
    RetVal NUMBER;
    P_ENV WB_RT_MAPAUDIT.WB_RT_NAME_VALUES;
    -- ventana principal
    BEGIN
    RetVal:= BARIK.LOAD_CUBO_RECARGA.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_TOR.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_TOAE.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_VIAJES.MAIN(P_ENV);
    RetVal:= BARIK.LOAD_CUBO_TICKETINCIDENCIA.MAIN(P_ENV);
    COMMIT;
    END;
    -- End of PROC_RUNLOADMAPPINGS;
    ,and when I run it, the mappings are executed, but with the CDC ones it doesn´t (even when no error is reported).
    I know that they are deployed in the selected agent (in my case the Default_Agent), but when I start them from the OWB, the mapping packages are created in the DB schema, so, I thought that maybe I could invoke them....so what you tell me is that the only way to invoke them is from SQL*Plus? not from a regular PL/SQL procedure?
    Thank you very much,
    Ana

Maybe you are looking for