Get sql querry from oraclecommand

hello,
i am using the oraclecommand with parameters to send a sql-query (for example: SELECT DOCID FROM SEARCHDOCUMENTS WHERE URL = :URL). Is there a chance to get the sql-querry whiich is executen on the oracle-server (for example: SELECT DOCID FROM SEARCHDOCUMENTS WHERE URL = 'http://www.oracle.com')?
greetings
jens

Hi Jens,
ODP tracing does not expose the bind values, you can get the value sent from the provider on the client with SQL NET tracing or you can turn on SQL Trace at a level that includes binds for the session you are interested and get the information that way.
HTH
Jenny B.

Similar Messages

  • Get SQL Query from the Region Source

    Hi,
    The below query gives me the region source code,
    SELECT region_source into p_sql_stmt
    FROM apex_application_page_regions
    WHERE region_id = 01129836282 AND
    page_id = 54 AND
    application_id = 215;
    Initially I use to have only the SQL region source code as mentioned below , So using the above query i use to pass the sql code to p_sql_stmt
    SELECT PROJECT_ID,EMPLOYEE_ID,EFFECTIVE_DATE FROM AR_V_ADDRESS_HISTORY WHERE PROJECT_ID = :P51_PROJECT_ID
    Now the changes what i did in the page region source is i am using a PLSQL return query which is mentioned below
    declare
    qry varchar2(32000);
    begin
    qry := ' SELECT PROJECT_ID,EMPLOYEE_ID,EFFECTIVE_DATE';
    for c1 in ( SELECT * FROM AR_ADDRESS_TYPE)
    loop
    qry := qry ||
    ' , GET_ADDRESS_LINE_1(PROJECT_ID,EMPLOYEE_ID,' || c1.address_type_id || ' ,TO_DATE(EFFECTIVE_DATE)) "' || c1.name ||'_ADDRESS_TYPE_1"';
    qry := qry ||
    ' , GET_ADDRESS_LINE_1(PROJECT_ID,EMPLOYEE_ID,' || c1.address_type_id || ' ,TO_DATE(EFFECTIVE_DATE)) "' || c1.name ||'_ADDRESS_TYPE_2"';
    end loop;
    qry := qry || ' FROM AR_V_ADDRESS_HISTORY
    WHERE
    PROJECT_ID = :P51_PROJECT_ID ';
    return(qry);
    end;
    If i execute the above code in the with dbms_output.put_line in the SQL developer or TOAD it prints the sql query which i wanted, Since i am using this in a apex page i need to get the SQL code from the apex page.
    Can any one please suggest me how to get this sql code using the above plsql code.
    Please suggest me in this issue
    Thanks
    Sudhir

    One way to get the sql statement is
    Create a global variable in the package spec where your function returns sql statement and assign the final sql statement to the package spec variable before the return.
    Write a wrapper function to return the stored sql statement value.
    Example code below:
    create or replace package xx_test_pkg as
    g_sql_stmt CLOB;
    function get_sql() return clob;
    function get_stored_val() return clob;
    end;
    create or replace body package xx_test_pkg as
    function get_sql return clob ..
    v_sqlstmt clob;
    begin
    v_sqlstmt := 'select * from emp';
    -- assign to global variable before returning the value
    g_sql_stmt := v_sqlstmt;
    return v_sqlstmt;
    end;
    function get_stored_val() ....
    begin
    return g_sql_stmnt;
    end;
    end;

  • BusinessObject 4.0 API to get SQL statement from webi or crystal report

    Hello,
    Need your help.... could you confirm whether BusinessObjects 4.0 provides any SDK, API or Web Service to get physical SQL statement from the webi or crystal reports file?
    If so, could you provide name of package, class and method?
    If I am not wrong, there is an SDK in v3.0 that allows to extract the SQL. But I am reading a lot on these forums that lot of SDK classes and functions are deprecated / removed in v4.0.
    Thanks for your help.
    Omer

    For Crystal Reports in BI 4.0 to retrieve the SQL query you can use Report Application Server SDK. Here is a code snippet that retrieves the SQL statement.
    //oInfoObjectReport is of type IInfoObject corresponding to the crystal report.
    ReportClientDocument reportClientDoc = reportAppFactory.openDocument(oInfoObjectReport, 0, Locale.ENGLISH);
            //for all crystal reports
            GroupPath grpPath = new GroupPath();
            //get CR SQL query string
            String reportSQL=reportClientDoc.getRowsetController().getSQLStatement(grpPath,null);
            System.out.println("report SQL String: "+reportSQL);
            //for report whose datasource is command object:
            Tables tables = reportClientDoc.getDatabaseController().getDatabase().getTables();
            for (int i = 0; i < tables.size(); i++)
             ITable table = tables.getTable(i);
             ICommandTable ic= (ICommandTable) table;
             //Command can be obtained from the report using getCommandObject() method
             //get CR SQL query string
             String SQLText=ic.getCommandText();
             System.out.println("SQLText_"+i+": "+SQLText);
    Here are useful links for BI 4.0
    [RAS API Specification|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_apiRef_en.zip]
    [RAS Developer Guide|http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rasjava_dg_en.zip]

  • Getting SQL statement from OCIStmt

    Is there a way to retrieve the SQL statement from OCIStmt structure? That is, does anyone know what this structure is? For example, if used OCIPrepareStmt, then bound all the variables to OCIStmt, can I tell from OCIStmt what the final SQL statement is? What about the statement string that was originally passed to OCIPrepareStmt()?
    Thanks!
    Igor

    Hey! Thanks for your time!
    use preparedStatements.I'm trying that
    Then use a wrapper class called
    [url=http://www.javaworld.com/javaworld/jw-01-2002/jw-0
    25-overpower.html]debuggableStatement. You willget the SQL that the driver is using.
    Is that only for Debugging or can i use that in live code?
    Thanks again,
    Ryan

  • How to get SQL text from dbms_sql cursor ID

    Hello,
    I have a progam using dbms_sql. A cursor is built by dbms_sql.parse (cur_id, v_query, dbms_sql.native);From now on I have only the internal ID cur_id of the cursor. Is there a way to get back the original query the cursor is built from when the cursor is passed to another package?
    Regards
    Marcus

    Oracle provides several views that show part or all of the SQL statement. See your Oracle version# Reference manual for v$sql...
    v$sqltext is one view that displays the full text but the text is contained in multiple rows.
    HTH -- Mark D Powell --

  • How to get SQL statement from (Collection) query.execute();

    We have a JDO Persistence class ClassName that execute query using following code. After this statement get executed, record does not get updated in the DB. Is there a way to check what SQL statement got submitted in the (Collection) query.execute(); ??? <br><br>
    Extent extent = pm.getExtent(ClassName.class, false); <br>
    Query query = null; <br>
    try { <br>
    query = pm.newQuery(extent, filter); <br>
    Collection results = (Collection) query.execute();<br>
    Iterator i = results.iterator();<br>
    if (i.hasNext()) {<br>
    ...<br>
    }<br>

    You can always find out the names of tables that are views, using java.sql.DatabaseMetaData and its getTables() method.
    This tends to be a nice source of examples:
    javaalmanac.com
    However, if you're asking for the underlying SQL used to CREATE VIEW, I don't see anything in the API that will give you that. After all, JDBC shouldn't have to know if it's dealing with an ordinary table or a view. I think you'd have to ask your DBA for the underlying SQL.
    Once you have it, what do you plan to do with it?
    %

  • Sql text from statspack tables

    Hi,
    How can I get sql information from statspack tables stats$sql_text, stats$sql_summarry..?
    I tried writting sql but not able to get the proper results, please help.
    select b.hash_value hash_value, a.snap_time snap_time, b.module module, b.fetches fetches, b.executions executions,
    b.rows_processed rows_processed, b.cpu_time cpu_time, b.elapsed_time elapsed_time from stats$snapshot a,stats$sql_summary b
    where a.snap_id=b.snap_id and b.snap_id between 1 and 13
    and I need to get the complete stats$sql_text.sql_text in the same query without using any procedure or function..
    version is 9.2.0.8.
    Thanks
    clin

    I'd also do this the way MOD says.
    But if you are feeling adventurous, you could explore cascading delete. You can specify a primary key with "on delete cascade", which makes referred-to records automatically delete. Google for oracle delete cascade or search your Oracle docs.
    I wouldn't do cascading deletes myself, though. For one, I've ran into enough trouble with many "smart" db features when trying to do db administration.

  • Getting windows error during running the sql scripts from form 6i

    I made a little form application. The purpose of this application is to generate explain plan for a particular SQL. Some sql scripts run internally in order to populate the result on form’s screen after pressing the form’s button but I am getting windows error during running the sql scripts from form 6i.
    I am using forms 6i with patch 17 with Oracle 10G database on windows 2000 professional on same computer.
    This application runs fine with 8i.
    Please inform me where the problem is and how to overcome it.
    Zafri.

    I am using Text_IO in my form's when button press trigger , inorder to create the
    text file, then in the same when button press triger
    I am calling RMAN via host command in order to run the script which was created by text_IO.
    Below you find some of the code. I will appreciate if you solve the problem.
    when button press trigger:
    Declare
    in_file3 Text_IO.File_Type;
    linebuf3 VARCHAR2(1800);
    output11 varchar2(1000);
    BEGIN
         output11:='C:\EXPLAIN_PLUS\misc\rm_file.bat ';
    Host(output11,no_screen);
    :sql.execution_plan:= 'Working........................';
    synchronize;
    in_file3 := Text_IO.Fopen('c:\explain_plus\misc\create_table.txt', 'w');
    Text_IO.Put_Line(in_file3, linebuf3);
    Text_IO.put_line(in_file3,' ');
    Text_IO.put_line(in_file3,' run { sql "create table PLAN_TABLE (statement_id,...object_name varchar2(30),object_instance numeric,object_type varchar2(30),optimizer varchar2(255),search_columns number,id .....partition_start varchar2(255),partition_stop  varchar2(255),partition_id numeric,other long,distribution varchar2(30)) "; } ');
    Text_IO.put_line(in_file3,' ');
    Text_IO.put_line(in_file3,' ');
    Text_IO.FCLOSE(in_file3)
              Declare
    un VARCHAR2(80);
    pw VARCHAR2(80);
    cn VARCHAR2(80);
    output VARCHAR2(1000);
    output2 VARCHAR2(1000);
    dummy varchar2(40);
    in_file Text_IO.File_Type;
    linebuf VARCHAR2(1800);
    BEGIN
         Get_Connect_Info(un,pw,cn);
         /* for Plan_table Begg. Second INNER BLOCK */
         declare
              dummy2 varchar2(40);
         begin
         select table_name into dummy2 from all_tables where table_name='PLAN_TABLE';
         if dummy2 = 'PLAN_TABLE' then
         output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\MISC\TRUNC2.txt ' ;
    Host(output2,no_screen);
         end if;
         exception
         when no_data_found     then
    output2:='rman target/ nocatalog @C:\EXPLAIN_PLUS\misc\create_table.txt ';
    Host(output2,no_screen);
         end; --

  • Get rid of SQL ID from database

    1. The SQL query is running nore than 30 mints with SQL ID aaaaabbb7RRRR . we killed the seesion and clear cache
    again we ran the query, the query is assigned to same sql ID aaaaabbb7RRRR we killed the seesion and clear cache
    ran query one more time it is assigned to same ID again
    anyone know how to get rid of SQL id from Database
    Edited by: user8680248 on 19/04/2010 22:32

    user8680248 wrote:
    I have shutdown the database and restarted , I can see the query assigened to teh same SQL IDYou seem to think SQL_ID is uniquely generated for each SQL Statement.
    I'd come to he conclusion that it is derived from the hash value of the SQL statement. Which to me means that the same SQL statement would result in the same SQL_ID. Some internet hits that support my way of thinking are
    http://www.experts-exchange.com/Database/Oracle/10.x/Q_23843388.html
    http://blog.tanelpoder.com/2009/02/22/sql_id-is-just-a-fancy-representation-of-hash-value/
    http://www.slaviks-blog.com/2010/03/30/oracle-sql_id-and-hash-value/
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:10353453905351
    from which I note that Tanel shows a way of converting the Hash value (derived directly from the statement) to the SQL_ID, and Tom says "sql_id survives database instance restarts and reloads."

  • MS SQL query to get Subscription list from Operations Manager

    Hi Experts,
    Is there anyway get Subscription list from Operations Manager DB using SQL query?  I lost subscription list, and need to create subscription as it was. Very urgent.
    Thanks in advance.
    Regards
    Karthick M

    Hi,
    Hope the powershell command Get-SCOMNotificationSubscription can be helpful for you:
    Get-SCOMNotificationSubscription
    Retrieves a list of notification subscriptions.
    https://technet.microsoft.com/en-us/library/hh918490(v=sc.20).aspx
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Need sql querry to retive the data from sysdate to last365 days data.

    Hi ,
    I need sql querry to retrive the data based on this condition:date Between Previous 365 days and current day.
    emp sal date
    1 200 03-mar-2011
    1 200 03-mar-2008
    1 200 06-mar-2012
    1 200 03-mar-2003
    1 200 03-mar-2004
    1 200 03-mar-2005
    and so on.......lot of records....
    i need the all the employee data from currentdate(sysdate) to previous 365 days data...
    Edited by: 937506 on Jun 7, 2012 4:26 AM

    937506 wrote:
    Hi ,
    I need sql querry to retrive the data based on this condition:date Between Previous 365 days and current day.
    emp sal date
    1 200 03-mar-2011
    1 200 03-mar-2008
    1 200 06-mar-2012
    1 200 03-mar-2003
    1 200 03-mar-2004
    1 200 03-mar-2005
    and so on.......lot of records....
    i need the all the employee data from currentdate(sysdate) to previous 365 days data...
    Edited by: 937506 on Jun 7, 2012 4:26 AMJust you can do this
    <date_column> between sysdate-365 and sysdateAnd DATE is a reserved word and you cannot use it as a column name.

  • I am not getting proper guidelines from apple regarding the querry

    I am not getting proper guidelines from apple regarding the querry, really iPhone is headache for me as I am unable to use the same from last 10 days

    If you would like help from here, you'll have to say what the problem is.  "Unable to use" and "not getting proper guidelines... regarding the query" tells nothing about your problem other than your phone isn't working.
    Also, judging by your other post where you are looking for an alternative to the iPhone, do you want a non-Apple phone or do you want your problem fixed.  No sense having people waste their time helping you fix this one if are going to get another phone.

  • How do i get a list of SQL Servers from network?

    Hi everyone,
    I'm trying to get a list of SQL Servers from the network and put them into a drop-down combo box. I try to search on Google and i can only find some C# source codes which doesn't help me at all. I'm wondering if JAVA has the similar method to do so.
    btw, I'm using MSSQL Server 2005, JDBC 1.2, JDK 1.6.0_24
    thanks

    jschell wrote:
    flyto9 wrote:
    I'd been told to create a user friendly no brainer user interface In typical business scenarios involving databases that is ridiculous.
    A company that has multiple database servers must ALREADY understand the complexities of managing and using those databases.
    true, but you know as well as I do that requirements documents are usually not written by people with the least understanding on those complexities...
    And if a company assigns such a project to someone like OP who clearly doesn't know how to deal with such requirements documents, that only shows their morosity all the more clearly :)
    Assuming that I'm able to find a list of TCP connections on network, how do I know which of them are sqlserver?That isn't what I said. A "protocol" is a description of a methodology involving functionality and communication which solves a particular problem.
    There is a "protocol" which describes how to find MS SQL Servers. You don't make it up yourself. You find the description, read what it says and implement it.Or more likely (like Oracle) there's no such security problem in MS SQL Server and instead it relies on the client knowing the connection details or it'll never find them.

  • Help required in writing an sql querry

    Hi guys,
    Could any one hlep me out in writing an sql querry for the below requirement.
    the requirement is: for a perticular ID if we have different names then we need to get it out as multiple else the name itselef. I have given the sample input and the expected output.
    ID Name
    1 A
    1 B
    2 F
    2 F
    3 C
    4 D
    4 E
    Out put should look like
    ID Name
    1 Multiple
    2 F
    3 C
    4 Multiple
    Thanks in advance
    Shylender.
    Edited by: 959345 on Nov 22, 2012 10:13 PM

    May be this:
    WITH t AS
            (SELECT 1 id, 'A' str FROM DUAL
             UNION ALL
             SELECT 1, 'B' FROM DUAL
             UNION ALL
             SELECT 2, 'F' FROM DUAL
             UNION ALL
             SELECT 2, 'F' FROM DUAL
             UNION ALL
             SELECT 3, 'C' FROM DUAL
             UNION ALL
             SELECT 4, 'D' FROM DUAL
             UNION ALL
             SELECT 4, 'E' FROM DUAL),
         t1 AS
            (SELECT id,
                    CASE
                       WHEN COUNT (DISTINCT str) OVER (PARTITION BY id) > 1 THEN
                          'MULTIPLE'
                       ELSE
                          str
                    END
                       str
               FROM t)
      SELECT id, str
        FROM t1
    GROUP BY id, str
    ORDER BY 1;Cheers,
    Manik.

  • Unable to get the data from the stored procedure

    Hello Folks,
    I have this stored procedure and am trying to get the data from the table stage_bill but for some reason i am not sure its not pulling the data.Am a beginner in pl/sql Can any one please help to find out. I can give the code below.
    create or replace procedure Load_FADM_Staging_Area_TEST(p_data_load_date date) is
    -- local variables
    v_start_date                date;
    v_end_date                  date;
    -- cursor starting
      CURSOR c_get_data
      IS
      SELECT
       a.batch_id 
    ,a.beginning_service_date 
    ,a.bill_id 
    ,a.bill_method 
    ,a.bill_number 
    ,a.bill_received_date 
    ,a.bill_status 
    ,a.bill_type 
    ,a.change_oltp_by 
    ,a.change_oltp_date 
    ,a.client_datafeed_code 
    ,a.client_id 
    ,a.created_date 
    ,a.date_of_incident 
    ,a.date_paid 
    ,a.deleted_oltp_by 
    ,a.deleted_oltp_date 
    ,a.duplicate_bill 
    ,a.ending_service_date 
    ,a.event_case_id 
    ,a.event_id 
    ,a.from_oltp_by 
    ,a.oltp_bill_status 
    ,a.review_status 
    ,'HRI' schema_name
    , sysdate Load_date
    ,'ETLPROCESS001' Load_user
    ,v_start_date as Row_Effective_Date
    ,null Row_End_date
    from stage_bill a
    where
    --created_date >= to_date('20101031 235959', 'YYYYMMDD HH24MISS')
    created_date >= v_start_date
    and
    --created_date <= to_date('20101111 235959', 'YYYYMMDD HH24MISS')
      created_date <= v_end_date
    and not exists
    (select
    b.batch_id 
    ,b.beginning_service_date 
    ,b.bill_id 
    ,b.bill_method 
    ,b.bill_number 
    ,b.bill_received_date 
    ,b.bill_status 
    ,b.bill_type 
    ,b.change_oltp_by 
    ,b.change_oltp_date 
    ,b.client_datafeed_code 
    ,b.client_id 
    ,b.created_date 
    ,b.date_of_incident 
    ,b.date_paid 
    ,b.deleted_oltp_by 
    ,b.deleted_oltp_date 
    ,b.duplicate_bill 
    ,b.ending_service_date 
    ,b.event_case_id 
    ,b.event_id 
    ,b.from_oltp_by 
    ,b.oltp_bill_status 
    ,b.review_status,
    b.schema_name,
    b.Load_date,
    b.Load_user,
    b.Row_Effective_Date,
    b.Row_End_Date
    from STG_FADM_HRI_STAGE_BILL_TEST b)
      -- cursor o/p variables
    v_batch_id                  stage_bill.batch_id%TYPE;
    v_beginning_service_date    stage_bill.beginning_service_date%TYPE;
    v_bill_id                   stage_bill.bill_id%TYPE;
    v_bill_method               stage_bill.bill_method%TYPE;
    v_bill_number               stage_bill.bill_number%TYPE;
    v_bill_received_date        stage_bill.bill_received_date%TYPE;
    v_bill_status               stage_bill.bill_status%TYPE;
    v_bill_type                 stage_bill.bill_type%TYPE;
      v_change_oltp_by            stage_bill.change_oltp_by%TYPE;
      v_change_oltp_date          stage_bill.change_oltp_date%TYPE;
      v_client_datafeed_code      stage_bill.client_datafeed_code%TYPE;
      v_client_id               stage_bill.client_id%TYPE;
      v_created_date          stage_bill.created_date%TYPE;
      v_date_of_incident    stage_bill.date_of_incident%TYPE;
      v_date_paid         stage_bill.date_paid%TYPE;
      v_deleted_oltp_by     stage_bill.deleted_oltp_by%TYPE;
      v_deleted_oltp_date    stage_bill.deleted_oltp_date%TYPE;
      v_duplicate_bill     stage_bill.duplicate_bill%TYPE;
      v_ending_service_date   stage_bill.ending_service_date%TYPE;
      v_event_case_id        stage_bill.event_case_id%TYPE;
      v_event_id            stage_bill.event_id%TYPE;
      v_from_oltp_by         stage_bill.from_oltp_by%TYPE;
      v_oltp_bill_status   stage_bill.oltp_bill_status%TYPE;
      v_review_status     stage_bill.review_status%TYPE;   
      v_schema_name        varchar(50);
      v_Load_date          date;
      v_Load_user            varchar(50);
      v_Row_Effective_Date   date;
      v_Row_End_Date         date;     
    Begin
    if  p_data_load_date is null then
        select (sysdate - 7), (sysdate - 1) into v_start_date, v_end_date from dual;
      elsif p_data_load_date is not null then
       select (p_data_load_date - 7), (p_data_load_date - 1) into v_start_date, v_end_date from dual;
      else
        raise_application_error('-20042', 'Data control - GetDataControlAuditData : Date parameter must be a date of this or a previous week.');
      end if;
    -- cursor c_get_data loop begin
    OPEN c_get_data;
        LOOP                                                       -- cursor c_get_data loop begin
          FETCH c_get_data
           INTO
            v_batch_id,
      v_beginning_service_date,
      v_bill_id ,
      v_bill_method ,
      v_bill_number,
      v_bill_received_date,
      v_bill_status,
      v_bill_type,
      v_change_oltp_by,
      v_change_oltp_date,
      v_client_datafeed_code,
      v_client_id,
      v_created_date,
      v_date_of_incident,
      v_date_paid,
      v_deleted_oltp_by,
      v_deleted_oltp_date,
      v_duplicate_bill,
      v_ending_service_date ,
      v_event_case_id ,
      v_event_id,
      v_from_oltp_by,
      v_oltp_bill_status,
      v_review_status,   
      v_schema_name,
       v_Load_date,
       v_Load_user,
       V_Row_Effective_Date,   
       v_Row_End_Date;
        EXIT WHEN c_get_data%NOTFOUND;
    insert into STG_FADM_HRI_STAGE_BILL_TEST
    batch_id 
    ,beginning_service_date 
    ,bill_id 
    ,bill_method 
    ,bill_number 
    ,bill_received_date 
    ,bill_status 
    ,bill_type 
    ,change_oltp_by 
    ,change_oltp_date 
    ,client_datafeed_code 
    ,client_id 
    ,created_date 
    ,date_of_incident 
    ,date_paid 
    ,deleted_oltp_by 
    ,deleted_oltp_date 
    ,duplicate_bill 
    ,ending_service_date 
    ,event_case_id 
    ,event_id 
    ,from_oltp_by 
    ,oltp_bill_status 
    ,review_status 
    ,schema_name
    ,Load_date
    ,Load_user
    ,Row_Effective_Date
    ,Row_End_Date
    values(
           v_batch_id,
    v_beginning_service_date,
    v_bill_id ,
    v_bill_method ,
    v_bill_number,
    v_bill_received_date,
    v_bill_status,
    v_bill_type,
    v_change_oltp_by,
    v_change_oltp_date,
    v_client_datafeed_code,
    v_client_id,
    v_created_date,
    v_date_of_incident,
    v_date_paid,
    v_deleted_oltp_by,
    v_deleted_oltp_date,
    v_duplicate_bill,
    v_ending_service_date ,
    v_event_case_id ,
    v_event_id,
    v_from_oltp_by,
    v_oltp_bill_status,
    v_review_status,   
    v_schema_name,
    v_Load_date,
    v_Load_user,
    v_Row_Effective_Date,   
    v_Row_End_Date ) ;
      COMMIT;
        END LOOP;                                                 
        CLOSE c_get_data; 

    Maybe you need something else, like
    CREATE OR REPLACE PROCEDURE load_fadm_staging_area_test (
      p_data_load_date DATE
    ) IS
      v_start_date   DATE;
      v_end_date     DATE;
    BEGIN
      SELECT NVL (p_data_load_date, SYSDATE) - 7,
             NVL (p_data_load_date, SYSDATE) - 1
      INTO   v_start_date,
             v_end_date
      FROM   DUAL;
      MERGE INTO stg_fadm_hri_stage_bill_test b
      USING      (SELECT *
                  FROM   stage_bill
                  WHERE  created_date BETWEEN v_start_date AND v_end_date) a
      ON         (b.bill_id = a.billl_id)
      WHEN NOT MATCHED THEN
        INSERT     (batch_id,
                    beginning_service_date,
                    bill_id,
                    bill_method,
                    bill_number,
                    bill_received_date,
                    bill_status,
                    bill_type,
                    change_oltp_by,
                    change_oltp_date,
                    client_datafeed_code,
                    client_id,
                    created_date,
                    date_of_incident,
                    date_paid,
                    deleted_oltp_by,
                    deleted_oltp_date,
                    duplicate_bill,
                    ending_service_date,
                    event_case_id,
                    event_id,
                    from_oltp_by,
                    oltp_bill_status,
                    review_status,
                    schema_name,
                    load_date,
                    load_user,
                    row_effective_date,
                    row_end_date
        VALUES     (a.batch_id,
                    a.beginning_service_date,
                    a.bill_id,
                    a.bill_method,
                    a.bill_number,
                    a.bill_received_date,
                    a.bill_status,
                    a.bill_type,
                    a.change_oltp_by,
                    a.change_oltp_date,
                    a.client_datafeed_code,
                    a.client_id,
                    a.created_date,
                    a.date_of_incident,
                    a.date_paid,
                    a.deleted_oltp_by,
                    a.deleted_oltp_date,
                    a.duplicate_bill,
                    a.ending_service_date,
                    a.event_case_id,
                    a.event_id,
                    a.from_oltp_by,
                    a.oltp_bill_status,
                    a.review_status,
                    'HRI',
                    SYSDATE,
                    'ETLPROCESS001',
                    v_start_date,
                    NULL
    END load_fadm_staging_area_test;Whenever you code a cursor and a loop, ask yourself. Do I need that?
    Regards
    Peter

Maybe you are looking for