SQL Buffering class / function in Oracle??

Hi All:
Im trying to write a java program that can make SQL transactions such as insert, update etc. I have questions regarding ways on doing so with JDBC.
Does Oracle have some kind of Array buffer like java classes that can let me serialize this class object and send it over to the DB (or let me point to / subclass such a class)? This object could contain a collected set of SQL statements that I want to execute. Once this object arrives in the DB, the DB will take care of it and execute all the SQL statements in the object accordingly.
I know that I can just execute the SQL statements individually at runtime. However, the reason I want to do this is because maintaining a JDBC connection might be expensive and natural disasters and happen to this connection, so I want to minimize JDBC access as much as possible. Therefore wondering if Oracle supports this kind of function.
Please point me to related documents. Or if you have some other idea can help me to solve my problem.
Thank you in advance!!
Mark
null

Try writing a stored procedure. See oracle docs for details.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mark Lin ([email protected]):
Hi All:
Im trying to write a java program that can make SQL transactions such as insert, update etc. I have questions regarding ways on doing so with JDBC.
Does Oracle have some kind of Array buffer like java classes that can let me serialize this class object and send it over to the DB (or let me point to / subclass such a class)? This object could contain a collected set of SQL statements that I want to execute. Once this object arrives in the DB, the DB will take care of it and execute all the SQL statements in the object accordingly.
I know that I can just execute the SQL statements individually at runtime. However, the reason I want to do this is because maintaining a JDBC connection might be expensive and natural disasters and happen to this connection, so I want to minimize JDBC access as much as possible. Therefore wondering if Oracle supports this kind of function.
Please point me to related documents. Or if you have some other idea can help me to solve my problem.
Thank you in advance!!
Mark<HR></BLOCKQUOTE>
null

Similar Messages

  • Service Bus 12c Class not found 'oracle.tip.pc.services.functions.ExtFunc'

    Hi,
    Did anyone came across this issue with Class not being found for XSLT Function used in transformer on 12c OSB.
    I'm using oraext:sequence-next-val and have configured as below:
    namespace-uri:http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc
    namespace-prefix: oraext
    Not sure why at runtime I'm getting below error, as the same was working fine in 11g OSB Domain.
    XML-22045: (Error) Extension function error: Class not found 'oracle.tip.pc.services.functions.ExtFunc'

    Have you restarted servers after putting jar in $Domain_Home/lib directory? Also try after explicitly adding this jar in classpath by editing server startup script (startManagedWeblogic.cmd or .sh) or in domain env setting script (setDonainEnv.cmd or .sh) and restarting the servers.
    Regards,
    Anuj
    Edited by: Anuj Dwivedi on Mar 21, 2011 1:10 PM

  • T-SQL functions in ORACLE

    Use T-SQL functions in ORACLE too, so you can write one script version that works in SYBASE, SQLSERVER and ORACLE when need to use the following functions:
    ceiling, charindex, dateadd, datediff, datename, datepart, day, db_id, db_name, getdate, host_id, host_name, left, len, month, replicate, right, space, str, str_replace, stuff, substring, suser_id, suser_name, user_id, user_name and year.
    The file [comp_tsql_ORA_schema.txt|http://forums.databasejournal.com/attachment.php?attachmentid=564&d=1258547015] creates the tablespace and schema to put the objects, and the file [comp_tsql_ORA.txt|http://forums.databasejournal.com/attachment.php?attachmentid=569&d=1259256898] creates the functions into the new schema. They will be avaliable for any schema of the oracle instance.
    Hope this help!
    Any suggestion please contact.
    aklein2003
    Edited by: user1958693 on 26/11/2009 10:16

    jgarry wrote:
    J2EE beta released around 1999. Religious programming wars far preceded that. Here's but [one example|http://groups.google.com/group/comp.lang.lisp/browse_thread/thread/1c50bc13e9302f00/34bb8f3ac77e2388?q=programming+language+religion#34bb8f3ac77e2388] from a quick google. I'm no longer convinced that elegance is a desirable trait for a language. So call me a heretic.
    Ever tried XLISP? :-)
    It's different. Back then it was simply the language itself. And it was not really a religious kind of battle, but more a mine-is-bigger-and-better-than-yours one.
    With Java, it is all about The Acrhitecture and the blessed language of Java. ;-)
    I wouldn't so much blame J2EE believers for that. I think there is a fundamental complexity to web type paradigms that hasn't been described in a precise and encompassing enough manner to enable correct project planning.The basic problem is that the database is treated as a persistent storage layer only. A bit bucket. And that is exactly what a database is not.
    But as it is used that, loads of database features now need to be duplicated in the application layer. Which is done. Very poorly.
    Heck, I've even been told that J2EE's 3-tier architecture is not client server. Such ignorance is really unbelievable. Or is it pure stupidity?Until you just made me look it up, I would have thought that too, I'm sure I saw client/server defined as two-tier in the last century. But I have much more stupid misdefinitions to deal with on a daily basis, simply from the multiplicity of paradigms. I tend to retreat into my shell. Hehehe. Know that feeling... These days I rather run away, or set shields to full power, than try to get in yet another frustrating, fruitless and futile discussion with a Java head about the wonders of the J2EE architecture. Or trying to explain that this "new" architecture is predated with what we used in the 80's on mainframe systems with transaction monitors, block devices (the 80's web browsers) and databases - which software layer for software layer was almost identical to "+The Great Architecture+" of today. (and we did it without buzzwords too) ;-)
    Client-server is a software architecture and in essence describes 3 basic software components. The User Interface (UI), the Application (APP) and the Database (DB). And there are various ways to put these components together in a client-server architecture. The mistake that the Java fanbois make is thinking that client-server means having the client as the UI and APP as a single component (so-called fat client) and then the DB component as the server.
    There are numerous versions of these - including the APP component being a server component (as we now these days more commonly used in over the web).
    My beef with the J2EE "+religion+" always has been that client-server is client-server. The fundamentals stay the same.

  • Access SQL Function in Oracle?

    Microsoft Access SQL has a function called LastOf which extracts
    data from a column within the last row returned when multiple
    rows are returned. This function works even when many tables are
    joined and only one of them returns multiple rows. Does Oracle's
    SQL implementation have anything like it?

    I can't find a reference to a LastOf function for MS-Access.
    Perhaps you are refering to the Last(expr) function or MoveLast
    method of DAO Recordset.
    Last behavior can be reached in one of several ways depending on
    the desired results, most depending on the ordering of the result
    set. Both Access and VB use the concept of a recordset, which is
    analogous to a CURSOR in Oracle.
    To use an implicit cursor, and only retreive the one row, you
    might use the sudo-colomn ROWNUM:
    SELECT my_col FROM my_tab WHERE ROWNUM = 1
    This would give you the first record of the result set, but there
    is no guarantee on which row it would be - so you might consider
    ordering the result set:
    SELECT my_col FROM my_tab WHERE ROWNUM = 1 ORDER BY my_col ASC;
    Which would return one row, the value of my_col being the
    smallest value in the table. Now might be a good time to talk
    aggrogate functions, such as:
    SELECT MIN( my_col ) FROM my_tab;
    which does the same thing as above.
    If all else fails, RTFM.
    -Kevin

  • Recursive functions in Oracle SQL.

    OK,
    Here is the pivot problem. Only this time were on an Oracle 11.1.0.7.0.
    I've created a table called:
    CREATE TABLE STAGING.MY_TAB_COLS
      TABLE_NAME   VARCHAR2(30 BYTE),
      COLUMN_NAME  VARCHAR2(30 BYTE)
    )And I've put the following data into it:
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'SSN_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'FIRST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'LAST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'DOB_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_SSN_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_FIRST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_LAST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_DOB_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'MPI');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'SSN_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'FIRST_NAME_A_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'FIRST_NAME_B_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'LAST_NAME_A_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'LAST_NAME_B_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_SSN_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_FIRST_NAME_A_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_FIRST_NAME_B_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_LAST_NAME_A_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAEADP1', 'EMP_LAST_NAME_B_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'MPI_OLD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_SSN_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_LAST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_FIRST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_DOB');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_SSN');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_LAST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_FIRST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_DOB');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_NON_SSN_ID');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_SSN_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_FIRST_NAME_A_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_FIRST_NAME_B_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_LAST_NAME_A_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_LAST_NAME_B_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_FIRST_NAME_A_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_FIRST_NAME_B_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_LAST_NAME_A_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'EMPLOYEE_LAST_NAME_B_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'PATIENT_SSN_STANDARDIZED');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAMAET1', 'MPI');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'EMPLOYEE_SSN');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'EMPLOYEE_FIRST_NAME');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'EMPLOYEE_LAST_NAME');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'EMPLOYEE_DATE_OF_BIRTH');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_SSN');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_FIRST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_LAST_NAME_SOURCE');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_DOB');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PRESCRIBER_LAST_NAME');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'MPI');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_FIRST_NAME_A_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_FIRST_NAME_B_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_LAST_NAME_A_STD');
    Insert into STAGING.MY_TAB_COLS
       (TABLE_NAME, COLUMN_NAME)
    Values
       ('AAPMED1', 'PATIENT_LAST_NAME_B_STD');My task for this problem is pretty straight forward.
    Using the ALL_TAB_COLS table I want to list out certain fields for each table name specified.
    All the tables have fields that are similar. I just want these table names to go across the top.
    And the field names to list out under each table.
    So you would have something like:
    AAEADP1                         AAMAET1                     AAPMED1
    SSN_SOURCE                      MPI_OLD                     EMPLOYEE_SSN
    FIRST_NAME_SOURCE               EMPLOYEE_SSN_SOURCE         EMPLOYEE_FIRST_NAME
    LAST_NAME_SOURCE                EMPLOYEE_LAST_NAME_SOURCE   EMPLOYEE_LAST_NAME
    DOB_SOURCE                      EMPLOYEE_FIRST_NAME_SOURCE  EMPLOYEE_DATE_OF_BIRTH
    EMP_SSN_SOURCE                  EMPLOYEE_DOB                PATIENT_SSN
    EMP_FIRST_NAME_SOURCE           PATIENT_SSN                 PATIENT_FIRST_NAME_SOURCE
    EMP_LAST_NAME_SOURCE            PATIENT_LAST_NAME_SOURCE    PATIENT_LAST_NAME_SOURCE
    EMP_DOB_SOURCE                  PATIENT_FIRST_NAME_SOURCE   PATIENT_DOB
    MPI                             PATIENT_DOB                 PRESCRIBER_LAST_NAME
    SSN_STANDARDIZED                EMPLOYEE_NON_SSN_ID         MPI
    FIRST_NAME_A_STANDARDIZED       EMPLOYEE_SSN_STANDARDIZED   PATIENT_FIRST_NAME_A_STD
    FIRST_NAME_B_STANDARDIZED       PATIENT_FIRST_NAME_A_STD    PATIENT_FIRST_NAME_B_STD
    LAST_NAME_A_STANDARDIZED        PATIENT_FIRST_NAME_B_STD    PATIENT_LAST_NAME_A_STD
    LAST_NAME_B_STANDARDIZED        PATIENT_LAST_NAME_A_STD     PATIENT_LAST_NAME_B_STD
    EMP_SSN_STANDARDIZED            PATIENT_LAST_NAME_B_STD   
    EMP_FIRST_NAME_A_STANDARDIZED   EMPLOYEE_FIRST_NAME_A_STD   
    EMP_FIRST_NAME_B_STANDARDIZED   EMPLOYEE_FIRST_NAME_B_STD   
    EMP_LAST_NAME_A_STANDARDIZED    EMPLOYEE_LAST_NAME_A_STD   
    EMP_LAST_NAME_B_STANDARDIZED    EMPLOYEE_LAST_NAME_B_STD   
                                    PATIENT_SSN_STANDARDIZED   
                                    MPI         Where each table name lists across with all of their column names under each table.
    The query that I have so far is The following:
      SELECT   T1.TABLE_NAME, T1.COLUMN_NAME
        FROM   my_tab_cols t1, (  SELECT   DISTINCT UPPER (SOURCE_TABLE) TABLE_NAME
                                     FROM MPI_DEMOGRAPHICS_TEST
                                 ORDER BY UPPER (SOURCE_TABLE)) tn
       WHERE   T1.TABLE_NAME = tn.TABLE_NAME
               AND (   T1.column_name LIKE '%MPI%'
                    OR T1.column_name LIKE '%SSN%'
                    OR T1.column_name LIKE '%E%SSN%'
                    OR T1.column_name LIKE '%R%SSN%'
                    OR T1.column_name LIKE '%P%SSN%'
                    OR T1.column_name LIKE '%BIRTH%'
                    OR T1.column_name LIKE '%DOB%'
                    OR T1.column_name LIKE '%FIRST%NAME%'
                    OR T1.column_name LIKE '%LAST%NAME%'
                    OR T1.column_name LIKE '%CLIENT%NAME%'
                    OR T1.column_name LIKE '%SOURCE_TABLE%'
                    OR T1.column_name LIKE '%TABLE%')
    ORDER BY   T1.TABLE_NAME, t1.column_id; It just list everything straight down.
    Where the MPI_DEMOGRAPHIES_TEST table feeds the relevant table names to the ALL_TAB_COLS table.
    It can just be substituted with a list of the values, AAEADP1, AAMAET1, AAPMED1.
    Is there a 'pivot' function in Oracle 11.1 that I can use to list these column names out sideways as opposed to what I did before?
    Thanks,

    Hi,
    Here's one way to get results like that using the Oracle 11 SELECT ... PIVOT feature:
    WITH     got_nums     AS
         SELECT     column_name
         ,     ROW_NUMBER () OVER ( PARTITION BY  table_name
                                   ORDER BY          column_name
                           )                    AS r_num
         ,     DENSE_RANK () OVER ( ORDER BY      table_name)     AS c_num
         FROM     my_tab_cols
            WHERE   column_name     LIKE '%MPI%'
            OR     column_name     LIKE '%SSN%'
    --      OR     column_name     LIKE '%E%SSN%'          -- Included in '%SSN% above
    --      OR     column_name     LIKE '%R%SSN%'          -- Included in '%SSN% above
    --      OR     column_name     LIKE '%P%SSN%'          -- Included in '%SSN% above
            OR     column_name     LIKE '%BIRTH%'
            OR     column_name     LIKE '%DOB%'
            OR     column_name     LIKE '%FIRST%NAME%'
            OR     column_name     LIKE '%LAST%NAME%'
            OR     column_name     LIKE '%CLIENT%NAME%'
    --      OR     column_name     LIKE '%SOURCE_TABLE%'     -- Included in %TABLE% below
            OR     column_name     LIKE '%TABLE%'
        UNION
            SELECT  table_name                         AS colum_name
         ,     0                              AS r_num
         ,     DENSE_RANK () OVER ( ORDER BY      table_name)     AS c_num
         FROM     my_tab_cols
    SELECT       *
    FROM       got_nums
    PIVOT       (   MIN (column_name)
           FOR c_num     IN ( 1     AS table_1
                            , 2     AS table_2
                      , 3     AS table_3
    ORDER BY  r_num
    ;Output:
    R_NUM TABLE_1                        TABLE_2                        TABLE_3
        0 AAEADP1                        AAMAET1                        AAPMED1
        1 DOB_SOURCE                     EMPLOYEE_DOB                   EMPLOYEE_DATE_OF_BIRTH
        2 EMP_DOB_SOURCE                 EMPLOYEE_FIRST_NAME_A_STD      EMPLOYEE_FIRST_NAME
        3 EMP_FIRST_NAME_A_STANDARDIZED  EMPLOYEE_FIRST_NAME_B_STD      EMPLOYEE_LAST_NAME
        4 EMP_FIRST_NAME_B_STANDARDIZED  EMPLOYEE_FIRST_NAME_SOURCE     EMPLOYEE_SSN
        5 EMP_FIRST_NAME_SOURCE          EMPLOYEE_LAST_NAME_A_STD       MPI
        6 EMP_LAST_NAME_A_STANDARDIZED   EMPLOYEE_LAST_NAME_B_STD       PATIENT_DOB
        7 EMP_LAST_NAME_B_STANDARDIZED   EMPLOYEE_LAST_NAME_SOURCE      PATIENT_FIRST_NAME_A_STD
        8 EMP_LAST_NAME_SOURCE           EMPLOYEE_NON_SSN_ID            PATIENT_FIRST_NAME_B_STD
        9 EMP_SSN_SOURCE                 EMPLOYEE_SSN_SOURCE            PATIENT_FIRST_NAME_SOURCE
       10 EMP_SSN_STANDARDIZED           EMPLOYEE_SSN_STANDARDIZED      PATIENT_LAST_NAME_A_STD
       11 FIRST_NAME_A_STANDARDIZED      MPI                            PATIENT_LAST_NAME_B_STD
       12 FIRST_NAME_B_STANDARDIZED      MPI_OLD                        PATIENT_LAST_NAME_SOURCE
       13 LAST_NAME_A_STANDARDIZED       PATIENT_DOB                    PATIENT_SSN
       14 LAST_NAME_B_STANDARDIZED       PATIENT_FIRST_NAME_A_STD       PRESCRIBER_LAST_NAME
       15 LAST_NAME_SOURCE               PATIENT_FIRST_NAME_B_STD
       16 MPI                            PATIENT_FIRST_NAME_SOURCE
       17 SSN_SOURCE                     PATIENT_LAST_NAME_A_STD
       18 SSN_STANDARDIZED               PATIENT_LAST_NAME_B_STD
       19                                PATIENT_LAST_NAME_SOURCE
       20                                PATIENT_SSN
       21                                PATIENT_SSN_STANDARDIZEDIf you don't want to see the r_num column, use your front-end to hide it (e.g., in SQL*Plus: "COLUMN r_num NOPRINT"), or do the pivot in a sub-query, and only select table_1, table_2 and table_3 in the main query.
    As with all pivots, you have to hard-code an upper bound to the number of pivoted columns. I used 3 above. You could use 4, or 5, or 45, but you must specify exactly how many columns to display.
    If you say there will be 3 tables, and there actually are more than 3, then the query will still run, but all the tables after the first 3 will be ignored.
    If you say there will be 3 tables, and there actually are fewer, then the query will still run, but you will have NULL columns at the end of each output row.
    This sorts the output alphabetically by table_name and column_name. You can sort by anything you want by changing the analytic ORDER BY clauses. For example, if you are using all_tabl_columns and you want the columns to appear in order by column_id, then you would say:
    ,     ROW_NUMBER () OVER ( PARTITION BY  table_name
                              ORDER BY          column_id     -- instead of column_name
                      )                    AS r_num

  • SQL Devloper Migration from SQL SerProcedurs created as Functions in Oracle

    Hi All,
    This is the first time I am using SQL Deveoper to migrate SQL Server database to Oracle.
    I have SQL Developer 3 and I did migration from SQL Sever 2008 to Oracle 10g using online migration.
    Everything was done perfectly, but there are some extra tables created in Oracle which are not present in SQL Server database.
    And also I observed lot of programs which are stored procedures in SQL Server are converted as functions in Oracle.
    Does someone knows how to fix this problem.
    Thanks

    Hi,
    A SQL*Server stored procedure can be converted to an Oracle function depending on how it is written and what it is doing. In the documentation -
    Oracle® SQL Developer
    Supplementary Information for Microsoft SQL Server and
    Sybase Adaptive Server Migrations
    In Chapter 3 in the section -
    3.4.2 Function
    It says under Table 3-6 -
    In Microsoft SQL Server or Sybase
    Adaptive Server, you can convert a stored
    procedure to a function in Oracle because
    the stored procedure in Microsoft SQL
    Server or Sybase Adaptive Server can
    RETURN an integer value to the calling
    routine using a RETURN statement. A
    stored procedure returns a status value to
    the calling routine even in the absence of
    a RETURN statement. The returned status
    is equal to ZERO if the procedure
    execution is successful or NON-ZERO if
    the procedure fails for some reason. The
    RETURN statement can return only
    integer values
    And what tables do you see in oracle that are not there in SQL*Server ? Some tables are created as part of the migration as they are needed to have the same functionality as in SQL*Server.
    Does your migrated Oracle database work in the same way as the SQL*Server database ? If not, then please give use specific examples and we can follow up.
    Regards,
    Mike

  • Invoking SQL Server function from Oracle

    Hi all,
    My question involves Oracle and SQL Server. I have a function in SQL Server that returns the count of rows in a table in SQL Server itself. I
    wish to invoke this function (in SQL Server) from Oracle. I have Transparent Gateway through which I usually connect to SQL Server to get the count. Is there a way in which I can execute the function (in SQL Server) from Oracle, something like below:
         select function_in_sql_server@transparent_gateway from dual;Thanks,
    ...

    I found below two links:
    how to call a sql server stored procedure from oracle
    http://en.allexperts.com/q/Oracle-1451/2008/6/Calling-SQL-Stored-procedure-1.htm
    Regards
    Girish Sharma

  • SOAP  oracle xml sql utility class definition not found error

    I have created a java class that connects to database using JDBC runs an sql statement and produces xml using Oracle XML SQL Utility class. The java class works perfectly when I deploy it as a soap web service and try to run through SOAP server it gives a SOAP error oracle/xml/sql/query/OracleXML/Query [java.lang.NoClassDefFoundError].
    Can anyone help please.
    Thanks
    Alina

    Sounds like you have not included the xsu12.jar file in the server-side CLASSPATH.
    This depends also on the xmlparserv2.jar and on the Oracle JDBC driver. Later versions
    of XSU may also depend on the xdb.jar file, too.

  • How can i migrate Power Builder 8.0 Function into oracle PL/SQL

    Hi Oracle Experts...
    How can i migrate Power Builder 8.0 Function into oracle PL/SQL.. I had migrate some of the coding from PB to PL/SQL. But i don't know how can i convert PB structure(here structure is a data type) into oracle PL/SQL.
    Instead of structure what is the equivalent in oracle plsql
    Below i pasted my POWER BUILDER FUNCTION:
    Long ll_perd,ll_lnperd,ll_mon,ll_effmon,ll_instno,ll_odno
    Decimal{5} ldl_actual,ldl_diff,ldl_inst
    Datetime ldt_first,ldt_exp,ldt_oddt, ldt_lastprod
    String ls_instmode,ls_inst
    str_batch lstr_od //Structure to store odamt and oddate
    Select pay_c_final,lon_d_expiry, lon_d_lastprod
    Into     :ls_inst,:ldt_exp, :ldt_lastprod
    From      loan_mast
    Where branch_c_code = :gs_branch and
              act_c_type      = :as_actype and
              act_c_no           = :as_acno;
    If Sqlca.Sqlcode = -1 Then
         f_message('FT-0189',Sqlca.Sqlerrtext)
         lstr_od.batchslno = -1
         Return lstr_od
    End If
    If adt_prodt > ldt_exp Then
         Select Ceil(months_between(:adt_prodt,:ldt_exp)) Into :lstr_od.batchslno From dual;
         lstr_od.cheqdt = ldt_exp
         lstr_od.batchslno = DaysAfter(Date(ldt_lastprod), Date(adt_prodt))
    Else
         If ls_inst = 'N' Then
              If adt_prodt > ldt_exp Then
                   Select Ceil(months_between(:adt_prodt,:ldt_exp)) Into :lstr_od.batchslno From dual;
                   lstr_od.cheqdt = ldt_exp
              Else
                   lstr_od.batchslno = 1
              End If
         ElseIf ls_inst = 'Y' Then
              Select first_d_due,lon_c_instperd,lon_n_perd
              Into     :ldt_first,:ls_instmode,:ll_lnperd
              From     loan_mast
              Where branch_c_code = :gs_branch and
                        act_c_type      = :as_actype and
                        act_c_no          = :as_acno;
              If Sqlca.Sqlcode = -1 Then
                   f_message('FT-0189',Sqlca.Sqlerrtext)
                   lstr_od.batchslno = -1
                   Return lstr_od // Return Structure
              End If
              Select Ceil(months_between(:adt_prodt,:ldt_first)) Into :ll_mon from dual;
              If ll_mon > 0 Then
                   Select Nvl(ln_n_balance,0),Nvl(ln_n_instlamt,0),Nvl(ln_n_instlno,0)
                   Into     :ldl_actual,:ldl_inst,:ll_instno
                   From     loan_inst_sch
                   Where act_c_type = :as_actype and
                             act_c_no     = :as_acno and
                             ln_d_effdate = (Select Max(ln_d_effdate)
                                                           From     loan_inst_sch
                                                           Where act_c_type = :as_actype and
                                                                     act_c_no     = :as_acno and
                                                                     ln_d_effdate < :adt_prodt);
                   If Sqlca.Sqlcode = -1 Then
                        f_message('FT-0224', Sqlca.Sqlerrtext)
                        lstr_od.batchslno = -1
                        Return lstr_od
                   ElseIf Sqlca.Sqlcode = 100 Then
                        lstr_od.batchslno = 1
    *                    Return lstr_od*
                   End If
                   If adl_bal > ldl_actual Then
                        If ldl_inst > 0 Then
                             lstr_od.batchslno = (adl_bal - ldl_actual) / ldl_inst
                        End If
                   Else
                        lstr_od.batchslno = 1
                   End If     
                   If lstr_od.batchslno = 0 Then lstr_od.batchslno = 1
                   //For full OD
                   If ll_mon > ll_lnperd Then
                        lstr_od.batchslno = (ll_mon - ll_lnperd) + lstr_od.batchslno
                   End If
                   If ls_instmode = 'Q' Then
                        lstr_od.batchslno = lstr_od.batchslno * 3
                   ElseIf ls_instmode = 'H' Then
                        lstr_od.batchslno = lstr_od.batchslno * 6
                   ElseIf ls_instmode = 'Y' Then
                        lstr_od.batchslno = lstr_od.batchslno * 12
                   End If
                   Select :adt_prodt - :lstr_od.batchslno Into :lstr_od.cheqdt From dual;
                   If ls_instmode = 'M' Then
                        ll_odno = ll_instno - lstr_od.batchslno // To get OD Date
                        Select ln_d_effdate
                        Into     :lstr_od.cheqdt
                        From     loan_inst_sch
                        Where act_c_type = :as_actype and
                                  act_c_no     = :as_acno and
                                  ln_n_instlno = :ll_odno;
                        If Sqlca.Sqlcode = -1 Then
                             f_message('FT-0224', + Sqlca.Sqlerrtext)
                             lstr_od.batchslno = -1
                             Return lstr_od
                        End If
                   End If
              Else
                   lstr_od.batchslno = 1
              End If
         End If
    End if
    Return lstr_od
    Thanks in adance
    Arun M M

    What are you going to return the structure to? What I would normally use here if the code was going to be used by other PL/SQL would be a PL/SQL object type.
    However, if PowerBuilder is still in the equation (you're moving the logic to PL/SQL but keeping PowerBuilder for the GUI ), then you'll have to return something else, because PowerBuilder doesn't understand PL/SQL object types. Perhaps passing a REF CURSOR as a OUT argument and populating it from the procedure. PowerBuilder could then retrieve the result of the procedure using a stored procedure based DataWindow.

  • Oracle.sql.* class

    In order to use oracle.sql.* class, what do I need besides classesXX.zip? I have oracle 8.1.6 standard edition for NT/2000.
    Houmin

    I think you can post this question better in some j2ee related subforum (or the OC4J standalone forum), but looking at the error you get I would guess that you have some broken (or missing) jdbc driver.

  • Calling SQL Server Function from Oracle Database link

    Hi ,
    i have some data from a old SQL server i would i can access with a database link but i cant call function from my database link.
    i would like to do something like
    @SPAN_PROD = Database link
    _EnerttObtApReelBassSys is a Table function from my SQL server
    SELECT *
    FROM "_EnerttObtApReelBassSys('20120504',4,1)"@SPAN_PROD
    WHERE DateEffectiveDebut <= GetDate()
    AND DateEffectiveFin > GetDate()
    any help ?
    Thnx

    951879 wrote:
    I have a SP in SQL Server which will return a Result Set.
    My requirement is to call that procedure in ORACLE using DB Link and insert that resultset(Data) in the temp table.First you need to setup Oracle to SQL Server connectivity. To do that you can either use HS - heterogeneous connectivity which comes for free or use Oracle Transparent Gateway which is not free. HS uses ODBC, so if your Oracle database in not on windows, you'll have to get ODBC SQL Server driver for Unix/Linux (e.g. from EasySoft). Since SQL Server selecting from table function syntax is different from Oracle's you will have to, if you use HS, to use DBMS_HS_PASSTHROUGH package. I never worked with Oracle Transparent Gateway to SQL Server, so I don't know if and how it supports selecting from SQL Server table function.
    SY.

  • How I work with MS-SQL function in oracle

    I’m working in oracle now but I don’t know how can I use following function in oracle.
    convert, dateadd, datediff, fetch_status, isnumeric, reverse, str and stuff

    Also available in 10g, the model clause version, taken from this How to display text in reverse order ?.
    WITH t AS (SELECT 'abcdefg' col1
                 FROM DUAL
                UNION
               SELECT ''
                 FROM DUAL   )
    SELECT col1
         , new_col1
      FROM t       
    MODEL
       PARTITION BY (ROWNUM rn)
       DIMENSION BY (0 dim)
       MEASURES     (col1, CAST ('' AS VARCHAR2(255)) new_col1)
       RULES ITERATE(99) UNTIL (LENGTH(new_col1[0]) = LENGTH(col1[0]))
          (new_col1[0] = SUBSTR(col1[0], ITERATION_NUMBER + 1, 1) || new_col1[0])
    COL1    NEW_COL1
    abcdefg gfedcbaC.

  • Pl/sql function body returning SQL query - Print function

    Hello all,
    I have pl/sql function body returning SQL query for my reports for my new project that I am developing. We dont have any BI tool or anything for APEX so we use Oracle reports to get the same reports to be printed in PDF format. I had been using SQL function for Reports all these days and grabbing the data using SQL query was easy in Oracle reports. But this time we had atleast 8 fields in search criteria and hence I thouhgt PL/sql function body returning SQL query could be something easy to handle that scenario. We have 11 such reports in our project. Now when we tried to use the same PL/sql function to oracle reports , I was told by one of our Oracle reports expert, that we have to write it into functions and use it in SQL query to get the Reports in Oracle reports. Is there any Easy way to convert the same Pl/SQL function or get a PDF format of the same report in APEX without going thru the much pains of rewriting the whole SQL Query.
    thank you
    Devisri

    Hi,
    give this a go.
    I can't test it as I don't have the tables in my schema.
    create or replace package MK_TEST_PF is
    -- Author  : MK
    -- Created : 21/06/2010 16:30:19
    -- Purpose : FOR LUCY_DISCOVER
    -- Public type declarations
    /*     -- just guess the table row types.....
         -- otherwise it won't compile
         type test_rec is record
              (INV REP.inv%type
              ,cNUMBER REP.cNUMBER%type
              ,OPENDATE REP.OPENDATE%type
              ,TARGETDATE REP.ESTCOMPLETE%type
              ,DATECLOSED REP.COMPLETED%type
              ,STATUS REP.STATUS%type
              ,cCODE REP.cCODE%type
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS REP.CLASS%type
              ,SUMM REP.SUMM%type
              ,AREA REP.AREA%type
         type test_rec is record
              (INV varchar2(4000)
              ,cNUMBER varchar2(4000)
              ,OPENDATE varchar2(4000)
              ,TARGETDATE varchar2(4000)
              ,DATECLOSED varchar2(4000)
              ,STATUS varchar2(4000)
              ,cCODE varchar2(4000)
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS varchar2(4000)
              ,SUMM varchar2(4000)
              ,AREA varchar2(4000)
         type test_tab is table of test_rec;
    -- Public constant declarations
    -- Public variable declarations
    -- Public function and procedure declarations
    end MK_TEST_PF;
    create or replace package body MK_TEST_PF is
    -- Private type declarations
    -- Private constant declarations
    -- Private variable declarations
    -- Function and procedure implementations
         function get_query_f
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              return varchar2
         is
              v_sql VARCHAR2(5000);
         --     v_inv VARCHAR2(100);
         --     v_reg VARCHAR2(100);
         --     v_proarea VARCHAR2(100);
         --     v_status VARCHAR2(100);
         --     v_SIG VARCHAR2(100);
         --     v_disp VARCHAR2(100);
         --     v_coding VARCHAR2(100);
         --     v_inc_sum VARCHAR2(4);
         --     v_word VARCHAR2(4000);
              v_wildcard VARCHAR2(2000);
         --     v_timeframe VARCHAR2(100);
         --     v_rec VARCHAR2(5);
              v_record VARCHAR2(5);
              v_open VARCHAR2(100);
              v_closed VARCHAR2(100);
              v_PEND VARCHAR2(100);
              v_refSIG VARCHAR2(100);
              v_refreg VARCHAR2(100);
              v_refother VARCHAR2(100);
              v_y varchar2(100);
         BEGIN
              --v_inv := UPPER(v('P44_INV')) ;
              v_record := 'R%';
              v_wildcard := '%';
              v_open := 'OPEN';
              v_closed := 'CLOSED';
              v_PEND := 'PEND';
              v_refSIG := 'REF - SIG';
              v_refreg := 'REF - CLASS';
              v_refother := 'REF - OTHER';
              v_y := 'Y';
              v_sql := 'SELECT REP.INV as INV, REP.cNUMBER as cNUMBER, REP.OPENDATE as OPENDATE,
              REP.ESTCOMPLETE as TARGETDATE, REP.COMPLETED as DATECLOSED, REP.STATUS as STATUS,
              REP.cCODE as cCODE, apex_item.checkbox(1,REP.line,null,'''||v_y||''') line , apex_item.checkbox(1,REP.SIG,null,'''||v_y||''') SIGc ,
              REP.CLASS as CLASS, REP.SUMM as SUMM, REP.AREA as AREA from REP where 1=1';
              IF p_rec is not null then
                   IF p_rec = 'E' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) not like '''||v_record||'''';
                   ELSIF p_rec = 'D' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) like '''||v_record||'''';
                   ELSIF p_rec = 'I' then
                        v_sql := v_sql|| ' and REP.cnumber = REP.cnumber ';
                   end if ;
              end if ;
              IF upper(p_status) not like '%NULL%' then
                   IF upper(p_status) like '%OPEN%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_open||'''';
                   ELSIF upper(p_status) like '%CLOSED%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_closed||'''';
                   ELSIF upper(v_PEND) like '%PEND%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_PEND||'''';
                   ELSIF upper(v_refSIG) like '%REF - SIG%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refSIG||'''';
                   ELSIF upper(v_refreg) like '%REF - CLASS%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refreg||'''';
                   ELSIF upper(v_refother) like '%REF - OTHER%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refother||'''';
                   END IF ;
              END IF ;
              IF p_inv = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.INV),'''||p_inv||''') > 0';
              END IF ;
              IF p_reg = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.CLASS),'''||p_reg||''') > 0';
              END IF ;
              IF p_proarea = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.AREA),'''||p_proarea||''') > 0';
              END IF ;
              IF p_disp = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.disposition),'''||p_disp||''') > 0';
              END IF ;
              IF p_coding = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.ccode),'''||p_coding||''') > 0';
              END IF ;
              IF p_SIG = ' ' THEN
                   v_sql := v_sql||' AND instr(upper(REP.SIG),'''||p_SIG||''') > 0';
              END IF ;
              IF p_word is not null then
                   v_sql := v_sql|| ' and
                   instr(upper(REP.SUMM),
                   upper(nvl('''||p_WORD_IN_SUMM||''',REP.SUMM))) > 0';
              end if ;
              If p_timeframe is not null then
                   if upper(p_timeframe) = 'OPEN' then
                   v_sql := v_sql|| ' and to_date(REP.opendate) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'CLOSED' then
                   v_sql := v_sql|| ' and to_date(REP.completed) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'EST' then
                   v_sql := v_sql|| ' and to_date(REP.estcomplete) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   end if;
              end if;
              v_sql := v_sql ||' order by REP.INV ';
              return v_sql;
         end get_query_f;
         function test_pf
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              RETURN test_tab PIPELINED
         is
              type test_c is ref cursor;
              v_row test_tab;
              v_sql varchar2(4000);
              v_cursor test_c;
         begin
              v_sql := get_query_f
                   (p_inv
                   ,p_reg
                   ,p_proarea
                   ,p_disp
                   ,p_coding
                   ,p_status
                   ,p_SIG
                   ,p_inc_sum
                   ,p_word
                   ,p_timeframe
                   ,p_rec
                   ,p_WORD_IN_SUMM
                   ,p_ON_AFTER
                   ,p_ON_BEFORE
              open v_cursor for v_sql;
              fetch v_cursor bulk collect into v_row;
              close v_cursor;
              for i in 1 .. v_row.count loop
                   pipe row (v_row(i));
              end loop;
              return;
         end test_pf;
    end MK_TEST_PF;
    /Regards
    Michael

  • Static class functions: PLS-00801: internal error [phd_get_defn:D_S_ED:LHS]

    Any ideas why this would generate an internal error - referring to a static class function in that class constructor's parameter signature?
    Test case (on 11.2.0.2) as follows:
    SQL> create or replace type TMyObject is object(
      2          id      integer,
      3          name    varchar2(30),
      4 
      5          static function DefaultID return integer,
      6          static function DefaultName return varchar2,
      7 
      8          constructor function TMyObject(
      9                  objID integer default TMyObject.DefaultID(), objName varchar2 default TMyObject.DefaultName()
    10          )return self as result
    11  );
    12  /
    Type created.
    SQL>
    SQL> create or replace type body TMyObject is
      2 
      3          static function DefaultID return integer is
      4          begin
      5                  return( 0 );
      6          end;
      7 
      8          static function DefaultName return varchar2 is
      9          begin
    10                  return( 'foo' );
    11          end;
    12 
    13          constructor function TMyObject(
    14                  objID integer default TMyObject.DefaultID(), objName varchar2 default TMyObject.DefaultName()
    15          )return self as result is
    16          begin
    17                  self.id := objId;
    18                  self.name := objName;
    19                  return;
    20          end;
    21 
    22  end;
    23  /
    Type body created.
    SQL>
    SQL> declare
      2          obj     TMyObject;
      3  begin
      4          obj := new TMyObject();
      5  end;
      6  /
    declare
    ERROR at line 1:
    ORA-06550: line 0, column 0:
    PLS-00801: internal error [phd_get_defn:D_S_ED:LHS]If the static class functions are removed from the constructor and applied instead inside the constructor body, it works without error. Likewise you can call the constructor with the static class functions as parameters, without an internal error resulting.
    SQL> create or replace type TMyObject is object(
      2          id      integer,
      3          name    varchar2(30),
      4 
      5          static function DefaultID return integer,
      6          static function DefaultName return varchar2,
      7 
      8          constructor function TMyObject(
      9                  objID integer default null, objName varchar2 default null
    10          )return self as result
    11  );
    12  /
    Type created.
    SQL>
    SQL> create or replace type body TMyObject is
      2 
      3          static function DefaultID return integer is
      4          begin
      5                  return( 0 );
      6          end;
      7 
      8          static function DefaultName return varchar2 is
      9          begin
    10                  return( 'foo' );
    11          end;
    12 
    13          constructor function TMyObject(
    14                  objID integer default null, objName varchar2 default null
    15          )return self as result is
    16          begin
    17                  self.id := nvl( objId, TMyObject.DefaultID() );
    18                  self.name := nvl( objName, TMyObject.DefaultName() );
    19                  return;
    20          end;
    21 
    22  end;
    23  /
    Type body created.
    SQL>
    SQL> declare
      2          obj     TMyObject;
      3  begin
      4          obj := new TMyObject();
      5  end;
      6  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> declare
      2          obj     TMyObject;
      3  begin
      4          obj := new TMyObject(
      5                          objID => TMyObject.DefaultID(),
      6                          objName => TMyObject.DefaultName()
      7                  );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> Had a quick look on support.oracle.com and did not turn up any specific notes dealing with the use of static class functions in the parameter signature of the constructor. Known issue? Any other workaround besides the one above?

    Hi,
    there is a bug: "Bug 8470406: OBJECT INSTANCE CREATION FAILS WITH ERROR PLS-00801 IN 11GR1", it shows the behaviour in 11g but not in 10.2. It gives exactly the symptoms you also see, move it to the body and it works. But there is no solution/patch given.
    Herald ten Dam
    http://htendam.wordpress.com

  • Help on java.sql.Types class

    Hai Friends ,
    I want some help on java.sql.Types class .
    What is the use of the above class ?
    Some details about this class.

    Good Morning Yekesa
    First of all i would like to thank U for looking into my problem.
    I am using java.sql.Types.OTHER for
    {"?=CALL(storedprocedurename.functionname(?))"}
    registerOutParameter(1,javal.sql.Types.OTHER)
    setString(2,"user")
    here the
    second parameter passes an argument to function name ( viz. username say "user")
    and the function will return the ref cursor as follows:
    // declaration in pl/sql procedure
    begin
    rc ref cursor
    open rc for select * from ss_user where login_name="user";
    return rc;
    end
    now the stored procedure has a return value (i.e. stored function) which it needs to register as
    registerOutParameter(1,javal.sql.Types.OTHER)
    and it finally results in the following errors :
    Loading driver
    Before conn stmt
    After conn stmt
    Calling Stored procedure
    Stored procedure called
    java.sql.SQLException: Invalid column type
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:243)
    at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:2487)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:64)
    at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:54)
    at sptest.<init>(sptest.java:28)
    at sptest.main(sptest.java:49)
    T couldn't understand why it is saying Invalid Column Type because its working fine with both
    java.sql.Types.INTEGER
    and
    java.sql.Types.VARCHAR
    Pl help me at the earliest as i have wasted a lot of time on it.
    pl mail me in detail at [email protected]
    bye then
    bansi
    null

Maybe you are looking for