Refcursor return set in plsql in oracle 10.2.0.4.0 db -

I am writing a function which returns the result set to front end application. it all works fine for existing rec but it returs bad/awkward message when non exiting rec is given...
declare
user_cur SYS_REFCURSOR;
BEGIN
OPEN user_cur FOR
SELECT pwd,
first_name,
last_name
FROM XS_user
WHERE u_id = i_u_id;
FETCH user_cur
INTO l_pwd,
l_f_n
l_l_n
IF (user_cur%NOTFOUND)
THEN
---- return false ; -- does not work!!?!?
RAISE_APPLICATION_ERROR (-20001, 'No User Id ');
END IF;
return user_cur;
end;
i want to return result set when matching record found and need to return nothing when no record found.. but it says for nonexisting rec is
ORA-06503: PL/SQL: Function returned without value
ORA-06512: at "xxxx.xxx_xxx_xxx", line 353
ORA-06512: at line 1
Script Terminated on line 4.
I need into clause as i need to check other conditions on data
would you please suggest how to return nothing when no matching record found..?

knowledgespring wrote:
here is full picture of code i am writingSeveral problems with the code. There is not need for an explicit cursor, never mind a ref cursor. If you expect a single row, then code for that. More rows will be a fail. And that will raise an exception as it should. Exceptions are good.
Also be very careful with ref cursors. The PL/SQL engine does not close these cursor handles for you - so if you do not explicitly close ref cursors, your code will be leaking cursor handles and causing resource problems.
Also, do not code the same conditional processing structures again and again:
if db_pass!=pwd then
raise_application_error(-20001,'password wrong');
end if;Modularise it. Look again at the reference I posted in my previous response and at how the Assert() procedure is used to modularise such conditional processing blocks (and how error codes and messages are treated as data - as that is what they are).
And once modularised - easy to use. Easy to maintain. Easy to enhance. For example, you need to log application exceptions via an autonomous transaction to an error log table? A single change to the code is needed. Why? Because a single procedure is used to raise custom application errors. Instead of having to hunt through the type of code you've posted, looking for all the raise_application_error() calls scattered throughout the code.
The sample code I referred to shows exactly how requirements like yours should be addressed. Modularised code that is readable and maintainable with minimal effort.
It is one of the worse programming sins to approach a problem by not modularising. It is wrong to throw all the code into a single code unit and turning it into a complex and monolithic monster. And that is why your code does not work and are full of errors.
Keep it simple. Create simplistic building blocks, like Assert() and RaiseError() procedures. Then use these blocks to build a complex process. The end-result might be a complex process, but one that is easy to understand, take apart, re-assemble, modify, enhance and maintain, because it consists of simple building blocks.
And that is why software development is called software engineering. Basic engineering principles apply in writing robust and scalable software. Principles you can either take to heart and apply.. or not - and continue designing and writing software messes... (and I wish someone preached this to me as a junior programmer and I did not have to learn these lessons the hard way)

Similar Messages

  • Return set of data from function

    Dear All
    How can i return set of data from from funtion into database?
    Thanks

    http://asktom.oracle.com/tkyte/ResultSets/index.html
    http://www.oracle-base.com/articles/8i/UsingRefCursorsToReturnRecordsets.php

  • Set  database  charcter set as us7ascii in oracle 11gr1

    Dear Friends,
    I want to set my character set as us7ascii in oracle 11gr1. But i heared that this charcterset is old charcter set and it is not used in oracle 11gr1.
    But client need this charcter set alone. They dont need any other equalent charcter set.
    What can i do?
    Please help me..

    user8665771 wrote:
    Then how can i change the charcter set(NLS_CHARACTERSET) from AL32UTF8 to US7ASCII .What is the reason behind this proposed change?
    Why do you think it is not possible to store ascii only characters with AL32UTF8?
    I think for this type of change, recommended procedure means creating a new db with the required charset.

  • Set User preferences in oracle portal’s database in portal environment

    Hi All,
    I need to set User preferences in oracle portal’s database in portal environment.
    I need to get some oracle PL/SQL API for the said purpose.
    In user preferences I need to save Preference name and preference value.
    Can any one have idea?
    Regards
    Amit Tiwari

    http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/index.html
    and http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/wwpre_api_name.html
    Patrick.

  • SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

    Hi all,
    In windiws 2008 server i have installed 11g wtih 11g Client for Pro*c . so there is two Oracle_Home resides. In the same machine i have installed 11g Forms and reports with weblogic server.
    Now i am not able to connect with the Database in SQL Prompt.more over if i issue SQLPLUS i am getting this below error
    "+Error 6 initializing SQL*Plus+"
    "*Message file sp1<lang>.msb not found*"
    "*SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory*"
    Here my Question and doubt is how i have to solve this issue.i want to use this 11g Database and 11g Forms and reports in single server. how to do this ?
    Kindly share your Advice.
    Regards
    Hamid

    Hameed wrote:
    "+Error 6 initializing SQL*Plus+"
    "*Message file sp1<lang>.msb not found*"
    "*SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory*"
    Here my Question and doubt is how i have to solve this issueIt is clearly said - set ORACLE_HOME prior to runing sqlplus.

  • How to set Spanish, ESN CP1252, , oracle Character Sets WE8MSWIN1252

    select * from NLS_DATABASE_PARAMETERS
    database characterset is
    NLS_CHARACTERSET               AL32UTF8
    NLS_NCHAR_CHARACTERSET         AL16UTF16 
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICAselect * from NLS_INSTANCE_PARAMETERS ;
    PARAMETER                         VALUE
    NLS_LANGUAGE                      SPANISH
    NLS_TERRITORY                     SPAINhow to set Spanish, ESN CP1252, , oracle Character Sets WE8MSWIN1252
    Please suggest.
    Thanks In advance

    Is it really ok to convert AL32UTF8 to WE8MSWIN1252?
    NLS_CHARACTERSET AL32UTF8
    to
    NLS_CHARACTERSET WE8MSWIN1252
    please suggest

  • Function that returns set of results

    Good morning!
    I need to make a function that would return set of results (records). I need to do a SELECT statement on that function later. Could someone throw me an example how to do this. I would be very gratefull. Thanks.
    EDIT: thing is i need to select list of objects that will match some complicated criteria and some mathematic calculations are needed (thats why i need to create a function).
    Message was edited by:
    user573095

    Or an example with multiple columns....
    SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
      2  ( col1   VARCHAR2(10),
      3    col2   VARCHAR2(10)
      4  )
      5  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
      2    v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
      3    v_obj myrec := myrec(NULL,NULL);
      4  BEGIN
      5    LOOP
      6      EXIT WHEN v_str IS NULL;
      7      v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
      8      v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
      9      IF INSTR(v_str,',')>0 THEN
    10        v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
    11        v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
    12      ELSE
    13        v_obj.col2 := v_str;
    14        v_str := NULL;
    15      END IF;
    16      PIPE ROW (v_obj);
    17    END LOOP;
    18    RETURN;
    19  END;
    20  /
    Function created.
    SQL>
    SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
    Table created.
    SQL>
    SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
    3 rows created.
    SQL>
    SQL> select * from mytab;
    COL1       COL2
    1          2
    2          3
    4          5

  • Setting heap size through oracleAS 10.1.3 enterprise manager

    Hi All,
    Can any body pls tell me how we can set java heap size through oracleAS 10.1.3 enterprise manager
    Best Regards
    Girish Tandel

    hi...
    Yes, we can set the heap size in opmn.xml file in java-options.... But this is not the good practice to mannualy edit server xml files. In OracleAS 10.1.2 we can set the same through OEM. But i am not able to set using oem in oracleas 10.1.3
    Best Regards
    Girish

  • Do I need to set Microsoft Driver for Oracle in Windows XP?

    Hi,
    I need to insert data into Oracle Table from java Code.
    I need to use JDBC-ODBC Bridge.
    The code is:
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.DatabaseMetaData;
    import java.sql.Connection;
    import java.sql.DriverPropertyInfo;
    import java.util.Enumeration;
    import java.util.Properties;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class DriverTest {
    String protocol ="jdbc:odbc://wbalud1b.npc.za:1572/ORA8D.NPC.ZA";
    String driverClass ="sun.jdbc.odbc.JdbcOdbcDriver";
    //Connection conn = DriverManager.getConnection(protocol,"TUTU_CONN","TUTU142");
    Connection connection;
    Statement statement;
    public void initialize() throws SQLException, ClassNotFoundException {
    Class.forName(driverClass);
    connection = DriverManager.getConnection(protocol);
    if(connection!=null)
    System.out.print("The Connection is not null now");
    public static void main(String args[]) {
    DriverTest driverTest = new DriverTest();
    try {
    driverTest.initialize();
    catch(SQLException sqlException) {
    while(sqlException !=null)
    sqlException.printStackTrace();
    sqlException = sqlException.getNextException();
    catch(Exception e)
    e.printStackTrace();
    }I am getting a runtime error.
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name too lon
    g
            at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
            at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
            at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
            at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:3
    23)
            at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
            at java.sql.DriverManager.getConnection(DriverManager.java:525)
            at java.sql.DriverManager.getConnection(DriverManager.java:193)
            at DriverTest.initialize(DriverTest.java:22)
            at DriverTest.main(DriverTest.java:35)Regards
    Taton

    Hi,
    I am getting runtime Exception:
    java.sql.SQLException: No suitable driver
            at java.sql.DriverManager.getConnection(DriverManager.java:545)
            at java.sql.DriverManager.getConnection(DriverManager.java:193)
            at DriverTest.initialize(DriverTest.java:24)
            at DriverTest.main(DriverTest.java:37)with the below code
    import java.util.Enumeration;
    import java.util.Properties;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class DriverTest {
    String protocol ="jdbc:odbc:thin:@wcalqd0b.pwc.ca:1522:ORA9D.PWC.CA";
    String driverClass ="oracle.jdbc.driver.OracleDriver";
    //Connection conn = DriverManager.getConnection(protocol,"REG_CONN","REG123");
    Connection connection;
    Statement statement;
    public void initialize() throws SQLException, ClassNotFoundException {
    Class.forName(driverClass);
    connection = DriverManager.getConnection(protocol);
    if(connection!=null)
    System.out.print("The Connection is not null now");
    public static void main(String args[]) {
    DriverTest driverTest = new DriverTest();
    try {
    driverTest.initialize();
    catch(SQLException sqlException) {
    while(sqlException !=null)
    sqlException.printStackTrace();
    sqlException = sqlException.getNextException();
    catch(Exception e)
    e.printStackTrace();
    }I have configured the classpath variable as
    SET Classpath=.;E:\Oracle\product\10.1.0\Client_1\jdbc\lib\classes12.jar;E:\Oracle\product\10.1.0\Client_1\jdbc\lib\ojdbc14.jar;D:\Program Files\Java\jdk1.5.0_15\bin;E:\Oracle\product\10.1.0\Client_1\bin;E:\Oracle\product\10.1.0\Client_1\jre\1.4.2\bin\client;E:\Oracle\product\10.1.0\Client_1\jre\1.4.2\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Sun\studio_04Q4\Ent_04Q4\modules\bin;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;
    Regards
    Taton

  • PLSQL Developer 与 Oracle SQL Developer 哪个更好?

    一直都是使用 PLSQL Developer 做一些开发, 想知道它与 Oracle SQL Developer 有什么不一样, 哪个更好用?

    我想对于这两个产品,哪个更好众说纷纭。我觉得各自有各自的优缺点。当然相对于PLSQL Developer 来说Oracle SQL Developer 的最大优点之一就是它的免费吧,当然它的很多细节上的功能还没有那么丰富。^_^
    你可以通过以下链接下载 Oracle SQL Developer
    http://www.oracle.com/technology/software/products/sql/index.html
    We’ve given up all of our licenses for other tools. We simply don’t need them anymore. Oracle SQL Developer does it all for us. We’ve saved a lot of money because it’s free. It’s also given our development staff a standard tool and they love it. It’s made training and support easier.
    以上是一个使用者的评论,你可以在下边的地址找到。
    http://www.oracle.com/technology/products/database/sql_developer/index.html

  • Tp return code 12 after update oracle from 9.2.0.4 to 9.2.0.8

    Hi
    tp return code 12 after update oracle from 9.2.0.4 to 9.2.0.8
    Please help me.
    Thank you

    Hi Maurizio,
    What does the transport logs says about the error?
    -Pinkle

  • Why do RefCursors return result sets in reverse order?

    Oracle XE version 10.2.0.1 (both windows and Linux perform the same).
    I'm porting code from DB2 to Oracle - our environment is mostly stored procedures returning REFCURSORS to a java layer. Many of the stored procedures return more than one REFCURSOR (please no posts on the value of packages vs procs, I understand the benefit but cannot switch at this time to packages). It took me a while to figure this out, but it appears that the cursors are returned in reverse order of their OUT param position(s). My fear is that this isn't always the case, but that the cursors could be open in some random order, in which case any conditional processing I have would need to account for that. Anyone experience this? Or can any Oracle guru explain why the cursors are open in reverse order? At this point in time, I do need to process them positionally rather than naming them -
    Here's a test case:
    CREATE TABLE TESTCUR(
    col1 NUMBER,
    col2 VARCHAR2(50)
    INSERT INTO TESTCUR VALUES (1, 'value for cursor 1');
    INSERT INTO TESTCUR VALUES (2, 'value for cursor 2');
    INSERT INTO TESTCUR VALUES (3, 'value for cursor 3');
    CREATE OR REPLACE PROCEDURE TESTREFCURSORMULTI (
      testcasenumber IN NUMBER,
      cv_1 OUT SYS_REFCURSOR,
      cv_2 OUT SYS_REFCURSOR,
      cv_3 OUT SYS_REFCURSOR
    AS
    BEGIN
         IF testcasenumber = 1 THEN
         OPEN cv_1 FOR
              SELECT col2
              FROM TESTCUR
              WHERE col1 = 1;
         OPEN cv_2 FOR
              SELECT * FROM DUAL WHERE 1=0;
         OPEN cv_3 FOR
              SELECT * FROM DUAL WHERE 1=0;
         ELSE
              IF testcasenumber = 2 THEN
              OPEN cv_1 FOR
                   SELECT col2
                   FROM TESTCUR
                   WHERE col1 = 2;
              OPEN cv_2 FOR
                   SELECT * FROM DUAL WHERE 1=0;
              OPEN cv_3 FOR
                   SELECT * FROM DUAL WHERE 1=0;
              ELSE
                   OPEN cv_1 FOR
                        SELECT col2
                        FROM TESTCUR
                        WHERE col1 = 1;
                   OPEN cv_2 FOR
                        SELECT col2
                        FROM TESTCUR
                        WHERE col1 = 2;
                   OPEN cv_3 FOR
                        SELECT col2
                        FROM TESTCUR
                        WHERE col1 = 3;
              END IF;
         END IF;
    END;
    set autoprint on
    var rc1 refcursor
    var rc2 refcursor
    var rc3 refcursor
    begin
    TESTREFCURSORMULTI(
    testcasenumber => 3,
    cv_1 => :rc1,
    cv_2 => :rc2,
    cv_3 => :rc3)
    end;
    /     Here are the results when opening all three:
    SQL> begin
      2  TESTREFCURSORMULTI(
      3  testcasenumber => 3,
      4  cv_1 => :rc1,
      5  cv_2 => :rc2,
      6  cv_3 => :rc3)
      7  ;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    COL2
    value for cursor 3
    COL2
    value for cursor 2
    COL2
    value for cursor 1Results when opening 1:
    SQL> set autoprint on
    SQL> var rc1 refcursor
    SQL> var rc2 refcursor
    SQL> var rc3 refcursor
    SQL> begin
      2  TESTREFCURSORMULTI(
      3  testcasenumber => 1,
      4  cv_1 => :rc1,
      5  cv_2 => :rc2,
      6  cv_3 => :rc3)
      7  ;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    no rows selected
    no rows selected
    COL2
    value for cursor 1

    It nothing more but the way how AUTOPRINT works:
    SQL>  set autoprint on
    SQL> var rc1 refcursor
    SQL> var rc2 refcursor
    SQL> var rc3 refcursor
    SQL> begin
      2  TESTREFCURSORMULTI(
      3  testcasenumber => 3,
      4  cv_1 => :rc1,
      5  cv_2 => :rc2,
      6  cv_3 => :rc3)
      7  ;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    COL2
    value for cursor 3
    COL2
    value for cursor 2
    COL2
    value for cursor 1
    SQL> set autoprint off
    SQL> begin
      2  TESTREFCURSORMULTI(
      3  testcasenumber => 3,
      4  cv_1 => :rc1,
      5  cv_2 => :rc2,
      6  cv_3 => :rc3)
      7  ;
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> print rc1
    COL2
    value for cursor 1
    SQL> print rc2
    COL2
    value for cursor 2
    SQL> print rc3
    COL2
    value for cursor 3
    SQL> As you can see, right cursor returned right result, just autoprint in case of multiple variables prints results starting last open cursor:
    SQL> set autoprint on
    SQL> begin
      2  open :rc1 for 'select 1 from dual';
      3  open :rc2 for 'select 2 from dual';
      4  open :rc3 for 'select 3 from dual';
      5  end;
      6  /
    PL/SQL procedure successfully completed.
             3
             3
             2
             2
             1
             1
    SQL> begin
      2  open :rc3 for 'select 3 from dual';
      3  open :rc2 for 'select 2 from dual';
      4  open :rc1 for 'select 1 from dual';
      5  end;
      6  /
    PL/SQL procedure successfully completed.
             1
             1
             2
             2
             3
             3
    SQL> SY.

  • UTL File not return any values in .CSV oracle plsql hrms

    Hello experts,
    We want to extract employee details from Core hrms with output as .csv file :
    i have created below package for utl but not return any values in csv file pls help me on this.:::
    CREATE OR REPLACE PACKAGE BODY APPS."XXPER_PAYROLL_XIR_PKG"
    AS
    procedure payroll_main (
    in_from_date IN date,
    in_to_date IN date,
    p_errbuf OUT VARCHAR2,
    p_retcode OUT NUMBER
    ) is
    cursor c_person is
    SELECT distinct ppf.person_id
    FROM per_person_types ppt,
    pay_payrolls_f pp,
    per_person_type_usages_f pptu,
    per_all_people_f ppf,
    per_all_assignments_f ppa
    WHERE ppf.person_id = pptu.person_id
    AND pptu.person_type_id = ppt.person_type_id
    AND ppt.user_person_type in ('Employee', 'Ex-employee' ,'Intern')
    AND ppf.person_id = ppa.person_id
    AND ppa.assignment_type = 'E'
    AND ppa.primary_flag = 'Y'
    AND ppa.payroll_id = pp.payroll_id
    -- and nvl(ppa.ass_attribute10, 'N') = 'Y' -- this is in Production
    AND pp.payroll_name = 'Calendar Payroll'
    AND trunc( ppf.last_update_date) between in_from_date and in_to_date
    AND trunc( ppa.last_update_date) between in_from_date and in_to_date
    AND trunc( ppt.last_update_date) between in_from_date and in_to_date
    AND trunc( pptu.last_update_date) between in_from_date and in_to_date
    AND trunc(sysdate) between ppf.effective_start_date and ppf.effective_end_date
    AND trunc(sysdate) between ppa.effective_start_date and ppa.effective_end_date
    AND trunc(sysdate) between ppf.effective_start_date and ppf.effective_end_date
    AND trunc(sysdate) between pptu.effective_start_date and pptu.effective_end_date
    AND ppf.employee_number <> 'NONE';
    v_person_id number;
    v_dom_eff_dt date;
    io_err_flag varchar2(1);
    io_err_desc varchar2(2000);
    io_record_update boolean;
    BEGIN
    dbms_output.put_line('in_from_date-' || in_from_date);
    dbms_output.put_line('in_to_date-' || in_to_date );
    open c_person;
    loop
    fetch c_person into v_person_id;
    exit when c_person%NOTFOUND;
    get_person_information( v_person_id ,
    in_from_date ,
    in_to_date ,
    io_err_flag ,
    io_err_desc );
    dbms_output.put_line('Per_id-' || v_person_id || ': ' || 'Payroll_main' || sqlcode || sqlerrm );
    end loop;
    close c_person;
    end payroll_main;
    PROCEDURE get_person_information(in_person_id IN number,
    in_from_date IN date,
    in_to_date IN date,
    io_err_flag IN OUT varchar2,
    io_err_desc IN OUT varchar2) is
    --v_service_date        DATE;
    v_data_file UTL_FILE.FILE_TYPE;
    v_record VARCHAR2(1000);
    v_header VARCHAR2(1000);
    v_record_mail VARCHAR2(1000);
    v_file_name VARCHAR2(100);
    v_file_name_mail VARCHAR2(100);
    v_ser_name VARCHAR2(50);
    v_dir VARCHAR2(100) :='XX_XIR_HR_PAY';
    v_con_req_id NUMBER;
    v_user_id NUMBER;
    v_resp_id NUMBER;
    v_resp_appl_id NUMBER;
    p_request_id NUMBER;
    P_status VARCHAR2(100);
    cursor c1 is
    SELECT ppf.person_id per_id,
    ppf.employee_number emp_num,
    ppf.first_name f_name,
    ppf.last_name l_name,
    ppf.national_identifier nat_id,
    ppf.date_of_birth dat_birth,
    ppf.sex sex_g,
    -- TO_DATE(ppf.attribute1,'DD-MON-YYYY') att_date,
    ppt.user_person_type per_type,
    ppf.email_address email_id,
    ppf.last_update_date last_upd_date
    FROM per_person_type_usages_f pptu,
    per_person_types ppt,
    per_people_f ppf
    WHERE ppf.person_id = in_person_id
    AND ppf.person_id = pptu.person_id
    AND pptu.person_type_id = ppt.person_type_id
    and trunc(ppf.last_update_date) between in_from_date and in_to_date
    and trunc( pptu.last_update_date) between in_from_date and in_to_date
    AND trunc( ppt.last_update_date) between in_from_date and in_to_date
    AND trunc(sysdate) between ppf.effective_start_date and ppf.effective_end_date
    AND trunc(sysdate) between pptu.effective_start_date and pptu.effective_end_date
    AND ppt.user_person_type in ('Employee', 'Ex-employee' ,'Intern')
    and ppt.system_person_type in ('EX_EMP', 'EMP') ;
    cursor c2 is
    SELECT substr(pa.address_line1, 1, 60) address_line1,
    substr(pa.address_line2, 1, 60) address_line2,
    pa.town_or_city city,
    pa.region_2,
    pa.postal_code,
    pa.region_1,
    pa.country,
    pa.date_from,
    nvl(pa.date_to, to_date('12/31/4712', 'mm/dd/yyyy')),
    pa.creation_date,
    pa.last_update_date
    FROM per_addresses pa
    WHERE pa.person_id = in_person_id
    AND pa.last_update_date between in_from_date and in_to_date
    AND trunc(sysdate) between date_from and nvl(date_to, to_date('12/31/4712', 'mm/dd/yyyy'))
    AND pa.primary_flag = 'Y';
    cursor c3 is
    SELECT pp.phone_number pnum
    FROM per_phones pp
    WHERE pp.parent_id = in_person_id
    AND pp.last_update_date between in_from_date and in_to_date
    AND trunc(sysdate) between date_from and nvl(date_to, to_date('12/31/4712', 'mm/dd/yyyy'))
    AND phone_type = 'H1';
    cursor c4 is
    SELECT ppos.period_of_service_id,
    ppos.date_start start_date,
    ppos.adjusted_svc_date,
    ppos.actual_termination_date,
    TO_DATE(ppos.attribute1,'yyyy/mm/dd hh24:mi:ss') last_day
    FROM per_periods_of_service ppos
    WHERE ppos.person_id = in_person_id
    AND ppos.last_update_date between in_from_date and in_to_date
    AND ppos.date_start = ( select max(date_start)
    from per_periods_of_service
    where person_id = in_person_id
    and trunc(date_start) <= trunc(sysdate) );
    Begin
    dbms_output.put_line('Directory:'||v_dir);
    BEGIN
    v_header := 'Employee Number'||CHR(9)
    ||'Fore Name'||CHR(9)
    ||'Sur Name'||CHR(9)
    ||'PPS'||CHR(9)
    ||'Date of birth'||CHR(9)
    ||'Gender'||CHR(9)
    ||'Person Type'||CHR(9)
    ||'Email Address'||CHR(9)
    ||'Last Update Date'||CHR(9)
    ||'Address1'||CHR(9)
    ||'Address2'||CHR(9)
    ||'Phone_Number'||CHR(9)
    ||'Start Date'||CHR(9)
    ||'Last Day';
    v_file_name :='XIR_DATA.xls';
    dbms_output.put_line('Excel_file_name:'||v_file_name);
    v_data_file :=UTL_FILE.FOPEN(v_dir,v_file_name, 'W');
    UTL_FILE.PUT_LINE(v_data_file,v_header);
    FOR i IN c1 LOOP
    FOR j IN c2 LOOP
    FOR k IN c3 LOOP
    FOR m IN c4 LOOP
    dbms_output.put_line(' excel file loop ');
    v_record:=i.emp_num||CHR(9)
    ||i.f_name||CHR(9)
    ||i.l_name||CHR(9)
    ||i.nat_id||CHR(9)
    ||i.dat_birth||CHR(9)
    ||i.sex_g||CHR(9)
    ||i.per_type||CHR(9)
    ||i.email_id||CHR(9)
    ||i.last_upd_date||CHR(9)
    || j.address_line1||CHR(9)
    ||j.address_line2||CHR(9)
    ||k.pnum||CHR(9)
    ||m.start_date||CHR(9)
    ||m.last_day;
    UTL_FILE.PUT_LINE(v_data_file,v_record);
    END LOOP;
    END LOOP;
    END LOOP;
    END LOOP;
    UTL_FILE.FCLOSE(v_data_file);
    dbms_output.put_line(' close excel file');
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('unable to create data excel file in proc1'||SUBSTR(SQLERRM,1,25));
    END;
    end get_person_information;
    END xxper_payroll_xir_pkg;
    EE Number     Forename     Surname     Dept     effective Start Date_dept     Start Date     Leave Date     effective Start Date_leave_Dt     Date of Birth     Address1     
    Thanks
    Edited by: 981527 on Feb 12, 2013 5:59 AM
    Edited by: 981527 on Feb 12, 2013 6:05 AM

    Did you make sure that the queries are returning values in the first place? From the last few lines, it looks like you have the header written to the file. Is that correct?
    -Karthik

  • Error with DG4ODBC while setting up connectivity from oracle to IBM iSeries AS400 version V7R1

    Hi,
    I have Enterprise linux 64-bit hosting Oracle 11gR2 64-bit (11.2.0.1) database.  I have access to IBM iSeries AS400 version V7R1.  I am trying to connect to IBM iSeries from Oracle Database through ODBC connectivity using Database Link.  The following is what I have done.
    On the Database (Linux) host Installed iSeriesAccess-7.1.0-1.0.x86_64.rpm provided by IBM.
    my odbcinst.ini has the following entries:
    [PostgreSQL]
    Description             = ODBC for PostgreSQL
    Driver          = /usr/lib/libodbcpsql.so
    Setup           = /usr/lib/libodbcpsqlS.so
    FileUsage               = 1
    [iSeries Access ODBC Driver]
    Description             = iSeries Access for Linux ODBC Driver
    Driver          = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
    Setup           = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
    NOTE1           = If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
    NOTE2           = the following Driver64/Setup64 keywords will provide that support.
    Driver64                = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
    Setup64         = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
    Threading               = 2
    DontDLClose             = 1
    UsageCount              = 1
    [iSeries Access ODBC Driver 64-bit]
    Description             = iSeries Access for Linux 64-bit ODBC Driver
    Driver          = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
    Setup           = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
    Threading               = 2
    DontDLClose             = 1
    UsageCount              = 1
    The odbc.ini has the following entries:
    [ODBC Data Sources]
    dg4odbc = connection to db2
    [dg4odbc]
    Driver = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
    Description=iSeries Access for Linux ODBC Driver
    LogonID=
    Password=
    Address=  (IBM host IP Address)
    location=Vm520
    noprompt=true
    system= (IBM host IP Address)
    UNICODE=UTF-8
    Naming = 0
    ConnectionType = 0
    CommitMode = 2
    ExtendedDynamic = 0
    AllowDataCompression = 1
    LibraryView = 0
    AllowUnsupportedChar = 0
    ForceTranslation = 0
    Trace = 0
    made sure I could connect via ODBC and DSN using the following command:
    isql dg4odbc oracle oracle1 -v
    +---------------------------------------+
    | Connected!                            |
    |                                       |
    | sql-statement                         |
    | help [tablename]                      |
    | quit                                  |
    |                                       |
    +---------------------------------------+
    SQL>
    SQLRowCount returns -1
    600 rows fetched
    SQL>
    could query the table in a library on AS400.
    The $ORACLE_HOME/hs/admin/initdg4odbc.ora has the following entries:
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO = dg4odbc
    HS_FDS_TRACE_LEVEL = off
    HS_FDS_SHAREABLE_NAME=/etc/newlib/libodbc.so
    HS_FDS_TRACE_LEVEL = 255
    HS_FDS_SUPPORT_STATISTICS=FALSE
    # ODBC specific environment variables
    set ODBCINI=/etc/odbc.ini
    # Environment variables required for the non-Oracle system
    The listener entries are as follows:
        (SID_DESC =
          (SID_NAME = dg4odbc)
          (ORACLE_HOME = /opt/oracle/dbs/product/11.2.0/dbhome_1)
          (PROGRAM = dg4odbc)
    Stopped and started the listener.
    The TNS entry is as follows:
    armcdb2 =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = vmw-dev-rmsdb.xxx.vmc)(PORT = 1521))
        (CONNECT_DATA =
        (SID=dg4odbc)
        (HS=OK)
    Could tnsping :
    oracle@rmsdev[/opt/oracle/dbs/product/11.2.0/dbhome_1/network/admin]$ tnsping armcdb2
    TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 11-JUL-2013 16:01:23
    Copyright (c) 1997, 2009, Oracle.  All rights reserved.
    Used parameter files:
    /opt/oracle/dbs/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vmw-dev-rmsdb.xxx.vmc)(PORT = 1521)) (CONNECT_DATA = (SID=dg4odbc)) (HS=OK))
    OK (0 msec)
    created a public database link as follows:
    SQL> create database link samplink connect to "oracle" identified by "oracle1" using 'armcdb2';
    Database link created.
    When I run a select query I get errors as follows:
    SQL> select * from mdiaz.AREMAIL@samplink;
    select * from mdiaz.AREMAIL@samplink
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    408
    Below is the Trace file of dg4odbc:
    Oracle Corporation --- THURSDAY  JUL 11 2013 16:06:03.627
    Heterogeneous Agent Release
    11.2.0.1.0
    Oracle Corporation --- THURSDAY  JUL 11 2013 16:06:03.627
        Version 11.2.0.1.0
    Entered hgogprd
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "255"
    Entered hgosdip
    setting HS_OPEN_CURSORS to default of 50
    setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
    setting HS_FDS_RECOVERY_PWD to default value
    setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
    setting HS_IDLE_TIMEOUT to default of 0
    setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
    setting HS_NLS_NCHAR to default of "AL32UTF8"
    setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
    setting HS_FDS_DATE_MAPPING to default of "DATE"
    setting HS_RPC_FETCH_REBLOCKING to default of "ON"
    setting HS_FDS_FETCH_ROWS to default of "100"
    setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
    setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
    setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
    setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
    setting HS_FDS_MAP_NCHAR to default of "TRUE"
    setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
    setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
    setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
    setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
    setting HS_FDS_QUERY_DRIVER to default of "TRUE"
    HOSGIP returned value of "FALSE" for HS_FDS_SUPPORT_STATISTICS
    Parameter HS_FDS_QUOTE_IDENTIFIER is not set
    setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
    setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
    setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
    Default value of 64 assumed for HS_FDS_SQLLEN_INTERPRETATION
    setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
    setting HS_FDS_DELAYED_OPEN to default of "TRUE"
    setting HS_FDS_WORKAROUNDS to default of "0"
    Exiting hgosdip, rc=0
    ORACLE_SID is "dg4odbc"
    Product-Info:
      Port Rls/Upd:1/0 PrdStat:0
      Agent:Oracle Database Gateway for ODBC
      Facility:hsa
      Class:ODBC, ClassVsn:11.2.0.1.0_0008, Instance:dg4odbc
    Exiting hgogprd, rc=0
    hostmstr:          0:   HOA After hoagprd
    hostmstr:          0:   HOA Before hoainit
    Entered hgoinit
    HOCXU_COMP_CSET=1
    HOCXU_DRV_CSET=871
    HOCXU_DRV_NCHAR=873
    HOCXU_DB_CSET=871
    HOCXU_SEM_VER=112000
    Entered hgolofn at 2013/07/11-16:06:03
    HOSGIP for "HS_FDS_SHAREABLE_NAME" returned "/etc/newlib/libodbc.so"
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLAllocHandle
    symbol_peflctx=0xaab7c2f0
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLBindCol
    symbol_peflctx=0xaab7c9d0
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLBindParameter
    symbol_peflctx=0xaab7cb6c
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLCancel
    symbol_peflctx=0xaab7d416
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLDescribeParam
    symbol_peflctx=0xaab7f7dc
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLDisconnect
    symbol_peflctx=0xaab7f978
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLEndTran
    symbol_peflctx=0xaab7fe42
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLExecute
    symbol_peflctx=0xaab808ac
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLFetch
    symbol_peflctx=0xaab80b5c
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLFreeHandle
    symbol_peflctx=0xaab816aa
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLFreeStmt
    symbol_peflctx=0xaab82144
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetData
    symbol_peflctx=0xaab83ad8
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetEnvAttr
    symbol_peflctx=0xaab84e42
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetFunctions
    symbol_peflctx=0xaab84fce
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLMoreResults
    symbol_peflctx=0xaab85a0a
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLNumResultCols
    symbol_peflctx=0xaab85fba
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLParamData
    symbol_peflctx=0xaab86102
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLPutData
    symbol_peflctx=0xaab871fc
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLRowCount
    symbol_peflctx=0xaab87364
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLSetEnvAttr
    symbol_peflctx=0xaab89054
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLSetDescRec
    symbol_peflctx=0xaab88e20
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLColAttributeW
    symbol_peflctx=0xaab7d6ba
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLColumnsW
    symbol_peflctx=0xaab7e264
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLConnectW
    symbol_peflctx=0xaab7e6b4
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLDescribeColW
    symbol_peflctx=0xaab7f39e
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLDriverConnectW
    symbol_peflctx=0xaab7fa9a
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLExecDirectW
    symbol_peflctx=0xaab805e6
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLForeignKeysW
    symbol_peflctx=0xaab80de6
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetConnectAttrW
    symbol_peflctx=0xaab82714
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetDescFieldW
    symbol_peflctx=0xaab83c76
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetDescRecW
    symbol_peflctx=0xaab83fbe
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetDiagFieldW
    symbol_peflctx=0xaab8448a
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetDiagRecW
    symbol_peflctx=0xaab84916
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetInfoW
    symbol_peflctx=0xaab85136
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetStmtAttrW
    symbol_peflctx=0xaab85456
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLGetTypeInfoW
    symbol_peflctx=0xaab8576e
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLPrepareW
    symbol_peflctx=0xaab863b0
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLPrimaryKeysW
    symbol_peflctx=0xaab8667c
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLProcedureColumnsW
    symbol_peflctx=0xaab86a14
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLProceduresW
    symbol_peflctx=0xaab86e64
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLSetConnectAttrW
    symbol_peflctx=0xaab874ac
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLSetStmtAttrW
    symbol_peflctx=0xaab896c8
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLSetDescFieldW
    symbol_peflctx=0xaab88b00
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLStatisticsW
    symbol_peflctx=0xaab89e64
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Entered hgolofns at 2013/07/11-16:06:03
    libname=/etc/newlib/libodbc.so, funcname=SQLTablesW
    symbol_peflctx=0xaab8a668
    hoaerr:0
    Exiting hgolofns at 2013/07/11-16:06:03
    Exiting hgolofn, rc=0 at 2013/07/11-16:06:03
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
    HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
    HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
    HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
    HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
    Invalid value of 64 given for HS_FDS_SQLLEN_INTERPRETATION
    treat_SQLLEN_as_compiled = 1
    Exiting hgoinit, rc=0 at 2013/07/11-16:06:03
    hostmstr:          0:   HOA After hoainit
    hostmstr:          0:   HOA Before hoalgon
    Entered hgolgon at 2013/07/11-16:06:03
    reco:0, name:oracle, tflag:0
    Entered hgosuec at 2013/07/11-16:06:03
    Exiting hgosuec, rc=0 at 2013/07/11-16:06:03
    Entered hgopoer at 2013/07/11-16:06:03
    hgopoer, line 233: got native error 408 and sqlstate 410; message follows...
    408
    Exiting hgopoer, rc=0 at 2013/07/11-16:06:03
    hgolgon, line 193: calling SQLSetConnectAttr got sqlstate 410
    Exiting hgolgon, rc=28500 at 2013/07/11-16:06:03 with error ptr FILE:hgolgon.c LINE:193 FUNCTION:hgolgon() ID:Connection Attribute: TRACE
    hostmstr:          0:   HOA After hoalgon
    RPC Calling nscontrol(0), rc=0
    hostmstr:          0: RPC Before Exit Agent
    hostmstr:          0:   HOA Before hoaexit
    Entered hgoexit at 2013/07/11-16:06:03
    Exiting hgoexit, rc=0
    hostmstr:          0:   HOA After hoaexit
    hostmstr:          0: RPC After Exit Agent
    I have looked up the errors on Oracle forums and could not get any valuable help anywhere.  
    Can someone kindly help out where I am going wrong?
    Thanks,
    Ram.

    Hello kgronau,
    Thank You very much for your recommendations.  I removed the parameter HS_FDS_TRACE_LEVEL = 255.
    I added HS_FDS_FETCH_ROWS=1 and also HS_NLS_NCHAR = UCS2
    Tested my sql statement, which yielded the result as follows:
    SQL> select * from mdiaz.AREMAIL@samplink;
    select * from mdiaz.AREMAIL@samplink
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    ㈵″㠵6
    SO I thought I would give a try of removing the line HS_NLS_NCHAR = UCS2
    and again tested my sql statement and it worked like a charm!!!!
    I tested a count(*) and got the results back.
    SQL> select count(*) from mdiaz.AREMAIL@samplink;
      COUNT(*)
           600
    I really appreciate your valuable pointers and help.
    Thanks once again!!!
    Ram.

  • Refcursor returning image (BLOB type) from database

    Hi,
    Process : Invoke activity takes ID as input parameter and passes it to partner link (db adapter) which executes stored proc returning a ref cursor. SQL statement in stored proc - ref cursor has a column with BLOB type.
    Problem : Unable to return an image (defiined as BLOB type in database) through refcursor in BPEL.
    Error : Unable to convert XSD element Column whose JDBC type is BLOB to a corresponding XML document element.
    ORABPEL-11087
    XSD :
    <complexType name="RowSet">
    <sequence>
    <element name="Row" minOccurs="0" maxOccurs="unbounded" nillable="true">
    <complexType>
    <sequence>
    <element name="Column" maxOccurs="unbounded" nillable="true">
    <complexType>
    <simpleContent>
    <extension base="string">
    <attribute name="name" type="string" use="required"/>
    <attribute name="sqltype" type="string" use="required"/>
    </extension>
    </simpleContent>
    </complexType>
    </element>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    Need Solution : To get an image (of BLOB type) into BPEL using ref cursor.
    Please let me know if you need any more information to get it working.
    Thanks and Regards,
    Rakesh

    Hi Rakesh,
    There are some notes you might want to refer :
    Note.423909.1      'java.lang.NumberFormatException' Signaled When Using Oracle LOB Family Column Types In ODI Datastores And Integration Interfaces:
         Note.423982.1      An "ORA-17410 No More Data to Read From Socket" Error Has Been Signaled From An ODI (Sunopsis) Integration Interface:
         Note.423768.1      Using Oracle Large Object (LOB) Datatype Columns In ODI Integration Interfaces:
         Note.744101.1      ORA-22835 Message Signaled When Using The OdiSqlUnload Tool In ODI:
         Note.424658.1      "ORA-00942" Message With Oracle Large Object (LOB) Datatype Fields In ODI Integration Interfaces:
         Note.423992.1      Using Oracle LONG Datatype Columns In ODI(Sunopsis):
         Note.424107.1      ODI Integration Interfaces And The Use Of Oracle Spatial Datatypes In Source And Target Datastores:
    Hope this helps!
    Cheers
    Anirudh Pucha

Maybe you are looking for

  • Is there a way i can view video streams to my mac on apple tv

    im new to macs but after getting an iphone 4 have got the bug. im struggleing with some of the ways macs work. i want to be able to view content streamed to my laptop on my tv. I have an apple tv box linked to my tv but cant figure out how to view wh

  • Battery and WiFi issues after upgrade to 1.1.1?

    Since my upgrade to 1.1.1, my iPhone has had HORRIBLE battery life. I charged it all night last night and it is only almost noon, and I have not used it much at all, and it is already DEAD. It forced shutdown just now. Another issue that I have been

  • Preview and filling in PDF forms broken in 10.5.7?

    I used to be able to fill in this form that I use all the time. Save it to an appropriate directory so I could Email it to the factory I deal with. Now it saves it as blank...kind of. In Quick Look, the form shows all filled in nicely. I open it in P

  • Tomcat to J2EE .... how to convert?

    Hi Guys I have been using tomcat for a while to do my School's Java Servlets and Jsp projects. Now my school require us to use only J2EE for my final year project. Im quite lost... i have done the tutorial for J2EE but still unsure how to make an exi

  • Photo uploaded from PC when posted, displays long description of image, instead of my own comments that were just typed.

    All previous saved and uploaded images were able to be posted without excessive, unwanted image descriptions. I typed my OWN comment to go along with my posting, but the image description appeared in the box instead. I tried posting ONLY the image, b