Pipelined functions from mssql using DG4MSQL

Hi to All
I have made installation of DG4MSQL 11.1 to connect Oracle db 10.2.0.4 to MSSQL server and found this problem.
On my MSSQL side there are piplined database objects , functions that behave like tables and which from mssql side is queried by forexample select * from table(parameter);
I tried to query objects on oracle db side using the same syntax like this:
select * from "table(parameter)"@sqlserverlink;
and this
select * from "table"@sqlserverlink (parameter);
and it gave error:
ORA-00933: SQL command not properly ended
Also tried standard oracle syntax for selecting from pipleined function like this :
select * from TABLE("table"@sqlserverlink(NULL));
or
select * from TABLE("table"(NULL)@sqlserverlink);
and it gives error
ORA-00933: SQL command not properly ended
.Can enynone give me some answer for this. Are piplined functions supported through DG4MSQL when connecting from oracle to mssql.
Greetings
Kenan

What is exactly the syntax of your object name.
Table, table and TABLE are 3 differents objects!!!!!
select object_name,object_type from all_objects@sqlserver where upper(object_name)='table';
====>normal , you have no row because your object name is not 'TABLE'
You have to respect the case sensivity
Try rather:
select object_name,object_type from all_objects@sqlserver where object_name LIKE '%able%';
So in your SQL SERVER (which version?) what do you see exactly???
In which object category do you see it?Is it a user defined function?
When you use a function, it is used to retrieve a value.
example: select "table"@sqlserver (NULL) from dual;
==>you get one rowwith one value
If your object is a table supposed to retrieve resultset (many rows) you can't pass it with a parameter:
select * from Table@sqlserver (NULL);
==>it won't work
So my question is also what are you supposed to retrieve when you select in SQL SERVER:
select * from table(null)
==>many rows or one row???
You can test with the DBMS_HS_PASSTHROUGH package:
DECLARE
ret integer;
c integer;
BEGIN
c := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@sqlserver;
DBMS_HS_PASSTHROUGH.PARSE@sqlserver(c, 'select * from table(null)');
ret := DBMS_HS_PASSTHROUGH.EXECUTE_NON_QUERY@sqlserver(c);
dbms_output.put_line(ret ||' passthrough output');
DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@sqlserver(c);
END;
If it is succesfull, you're supposed to get:
===>1 passthrough output
Please give me all the information and I could help you more.
Regards
Mireille

Similar Messages

  • Can I call a C function from Java (using JNI) ??

    hello,
    I need to call one C function from remote device and get its return value(o/p) (for my application it is device SSID ) and display in the client PC.
    Is it possible in java without using SNMP connction?.
    please give me idea about it.
    I need this information as soon as possible.
    Thank you.

    see JNI...
    basically declare a native method in your java class, then run javah on the class thus generating a *.h file. Then implement the c/c++ function. Compile the c/c++ part as a shared library, and make sure its accessible from your LD_LIBRARY_PATH env variable.
    Go through the steps in the JNI docs, and things shoulde be fine... hopefully ;)

  • Is it possible to call Java functions from XSLT, using standard Java 6?

    I have seen examples, but the examples are always the most simple case, which even I can already get working. The case where no arguments are passed to the java function.
    As soon as I try to pass an argument to the java function, i get a stupid unhelpful error message (as always error messages are unhelpful).
    Or am I wasting my time using the standard provided java parser, and need to use apache or something?
    anyone who can provide me with a couple lines of working code is to me a saint!
    At the moment I am using calling a named template, and passing a param into this.
    I want to use this param as an argument in the Java function.
    Is this possible?
    example code:
         <xsl:template name="calc-age">
              <xsl:param name="dob"/>          
         <xsl:variable name="sdob" select="java:lang.String.new($dob)"/>
         <xsl:value-of select="java:toString($sdob)"/>     
         </xsl:template>

    I have fixed it.
    I had to call an xslt 1 function 'string' on the variable before passing it into the java function (see below).
         <xsl:template name="calc-age">
              <xsl:param name="dob"/>          
              I know that the value of the param is: <xsl:value-of select="$dob"/><br/>     
             <xsl:variable name="poo" select="$dob"/>
             <xsl:variable name="sdob" select="java:lang.String.new(string($poo))"/> 
             And here again, we try to print a variable<xsl:value-of select="$poo"/>                <br/>
             And here again, we try to print the result of the java call<xsl:value-of select="java:toString($sdob)"/>      <br/>
             and here is our variable sdob    <xsl:value-of select="$sdob"/>             
         </xsl:template>          Now this is APPARENTLY a xslt-1 function,
    but the reference I had been using for this is
    http://www.w3schools.com/xpath/xpath_functions.asp it is linked to by a reference that calls these xslt-2 functions.
    Maybe they are mixed xslt-1 and xslt-2 functions?
    How am I supposed to know?
    Where is a good (plain and simple, easy to read) reference for xsl, so i know which functions are which?
    Anyone got a good answer to that question?

  • PL/SQL Pipelined Function to Compare *ANY*  2 tables

    I am trying to create a pipelined function in 10g R1 that will take the name of two tables, compare the the tables using dynamic SQL and pipe out the resulting rows using the appropriate row type. The pipelined function will be used in a DML insert statement.
    For example:
    create table a (f1 number, f2, date, f3 varchar2);
    create table b (f1 number, f2, date, f3 varchar2);
    create table c (f1 number, f2, date, f3 varchar2);
    create or replace TYPE AnyCollTyp IS TABLE OF ANYTYPE;
    create or replace TYPE CRowType IS c%ROWTYPE;
    create or replace TYPE CRowTabType IS table of CRowType;
    CREATE OR REPLACE FUNCTION compareTables (p_source IN VARCHAR2, p_dest IN VARCHAR2)
    RETURN AnyCollTyp PIPELINED
    IS
    CURSOR columnCur (p_tableName IN user_tab_columns.table_name%TYPE)
    IS
    SELECT column_name, column_id
    FROM user_tab_columns
    WHERE table_name = p_tableName
         ORDER BY column_id;
    l_cur sys_refcursor;
    l_rec ANYTYPE;
    l_stmt VARCHAR2 (32767);
    BEGIN
    l_stmt := 'select ';
    FOR columnRec IN columnCur (p_dest)
    LOOP
    l_stmt := l_stmt || CASE
    WHEN columnRec.column_id > 1
    THEN ','
    ELSE ''
    END || columnRec.column_name;
    END LOOP;
    l_stmt := l_stmt || ' from ' || p_source;
    l_stmt := l_stmt || ' minus ';
    l_stmt := l_stmt || ' select ';
    FOR columnRec IN columnCur (p_dest)
    LOOP
    l_stmt := l_stmt || CASE
    WHEN columnRec.column_id > 1
    THEN ','
    ELSE ''
    END || columnRec.column_name;
    END LOOP;
    l_stmt := l_stmt || ' from ' || p_dest;
    OPEN l_cur FOR l_stmt;
    LOOP
    FETCH l_cur
    INTO l_rec;
    PIPE ROW (l_rec);
    EXIT WHEN l_cur%NOTFOUND;
    END LOOP;
    CLOSE l_cur;
    RETURN;
    END compareTables;
    The pipelined function gets created without error. However, the testCompare procedure gets an error:
    SQL> create or replace procedure testCompare is
    begin
    insert into c
    select *
    from (TABLE(CAST(compareTables('a','b') as cRowTabType)));
    dbms_output.put_line(SQL%ROWCOUNT || ' rows inserted into c.');
    end;
    Warning: Procedure created with compilation errors.
    SQL> show errors
    Errors for PROCEDURE TESTCOMPARE:
    LINE/COL ERROR
    3/4 PL/SQL: SQL Statement ignored
    5/47 PL/SQL: ORA-22800: invalid user-defined type
    Does anyone know what I am doing wrong? Is there a better way to compare any two tables and get the resulting rows?

    904640 wrote:
    Hi All,
    Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
    From this Queue, message will be read by OSB interface.
    Any help will be highly appreciated.
    http://www.lmgtfy.com/?q=oracle+pl/sql+weblogic+jms+queue

  • How the performance will increase with pipelined function.

    Respects all,
    Can u please help to explain one example regarding which i have mentioned in the subject line.
    Thanks

    Hi,
    pipelined functions don't "increase performance".
    1) This is an entirely wrong way to think about Oracle features. There are no Oracle features that automatically "increase performance", like some sort of a "turbo" button (not even partitioning! not even indexes!). Most of the features can work both ways -- when used appropriately, they improve performance, when not, they can cripple it.
    2) Pipelined functions are not about performance. They simply provide a way for you to SELECT from a PL/SQL function (which otherwise is impossible to do). Not only you can generate sets of values this way, but also you can join it with other tables/views, that can be very convenient. Pipelined functions can also be very convenient for generating formatted text reports they allow you to bypass limitations of long/lob data types). But none of this has to do with performance.
    3) Pipelined functions are inevitably associated with row-by-row processing (because there is no way to pipe a set of rows at once). So when the choice is between returning a refcursor (from which you can do a bulk fetch), and using a pipelined function, from which you'll be returning rows one by one, and none of items listed in 2) applies, then chances are that pipelined function is going to be slower.
    So whoever claimed that "pipelined functions increase performance", either he/she is incompetent, or you took his/her words out of the context or misintepreted them.
    Best regards,
      Nikolay

  • Apex3.2.1 pipelined functions with parameters send cpu to 100 percent

    I have just installed 11g and exported a schema from 10g into it.
    When I run Apex3.2.1 and open a page with a flash chart that running off a table object populated by a pipelined function the CPU goes in overload 100%.
    I have tracked the problem to parameters on the pipelined function if I use bind parameters( :P640_YEARS, :P640_EMPLOYER_ID) then the problem happens but if I hard code values all is fine (2010,99).
    This happens with every flash chart we have, which makes our application and database unusable.
    Any ideas.
    Derek

    Thanks very much for the posts, I took the opportunity to upgrade to Apex 4.0.2 as suggested by Patrick and the application works fine again now.
    Interestingly I did re-analyse the statistics but only as a reaction to the problem, should have been done regardless.
    I did consider re-writing the pipelined functions but to be honest it would have been difficult as they are extremely complex, I wasn't looking forward to the task. I have become quite a fan of pipelined functions for building flash charts, dash boards extra, its as always about tuning the sql.
    Thanks very to all
    Derek
    Edited by: 835735 on Feb 10, 2011 1:50 PM

  • Is there any way to pass through PIPELINED function

    Hello,
    For clarity of my code I would like to move some part of my PIPELINED function out to sub-function. It there any way to call one PIPELINED function from other PIPELINED function a way to union their results?
    I can try to use temporary table to emulate such behavior, but it won't be exactly the same...
    Regards

    Yes, you can. The only thing you need to remember is pipelined function can be salled from SQL only. So your functions will look like:
    Pipelined function 1:
    create or replace
      function pipelined_function1(...)
        return ...
        pipelined
        is
        begin
            pipe row(...);
    end;
    /Pipelined function 2:
    create or replace
      function pipelined_function2(...)
        return ...
        pipelined
        is
        begin
            for v_rec in (select * from table(pipelined_function1(...))) loop
              pipe row(...);
            end loop;
            pipe row(...);
    end;
    /SY.

  • Error PLS-00306 during calling PL/SQL function from Java

    Hi all,
    I am facing a problem during call of oracle PL/SQL function from java using CallableStatement.
    I receive following error message.
    java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    As per above error EXPORT_HIST_ALARMS_FUNC in oracle has this signature.
    CREATE OR REPLACE FUNCTION EXPORT_HIST_ALARMS_FUNC(startDateTime VARCHAR2, endDateTime VARCHAR2, meType VARCHAR2) RETURN VARCHAR2 IS
    END EXPORT_HIST_ALARMS_FUNC;
    Above function I have called following way in java.
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(2,startDateTime);
    cStatement.setString(3,endDateTime);
    cStatement.setString(4,meType);
    cStatement.execute();
    msg = cStatement.getString(1);
    Actually above function requires three input parameters and one return parameter.
    During execution of above java code it throws SQLException and shows PLS-00306: wrong number or types of arguments in call to 'EXPORT_HIST_ALARMS_FUNC' error.
    I have run this function directly from oracle with three parameters and run successfully and finally it returns string.
    But I am unable to figure out why it doesn't run from above java code.
    Please help regarding this.
    Thanks.
    Regards,
    Shardul Banker

    Try this:
    String sql = "begin ?:= EXPORT_HIST_ALARMS_FUNC(?, ?, ?); end;" ;
    CallableStatement cStatement = null;
    cStatement = connection.prepareCall(sql);
    cStatement.registerOutParameter(1,Types.VARCHAR);
    cStatement.setString(1,startDateTime);
    cStatement.setString(2,endDateTime);
    cStatement.setString(3,meType);
    cStatement.execute();
    msg = cStatement.getString(1);Regards,
    Martijn Teigeler
    Edited by: mTeigeler on Oct 13, 2007 10:22 AM

  • Multiple values from a single function to be used SQL

    I have some pl/sql code that calculates multiple values in the same procedure (multiple out parameters).
    Now I want to use these separate values in an SQL select.
    One way to do it, is creating functions for each separate value.
    Performance wise, I don't want to do so.
    I created an object type with 9 number values.
    A function returns the object type and I select it in a subquery.
    The outer query then selects 3 different values from the object in the subquery.
    Unfortunately, a query with 3 rows still results in the function being called 9 times (3 row x 3 values).
    Is there a way to force the object function being called just once per row ?
    Or is there an alternative way?
    I've tried pipelined functions but then I have trouble with the input values for the function that should be taken from another select.
    result will be a view with a key value and the calculated values
    SELECT key_value, calculated_value1, calculated_value2, calculated_value3
    FROM SOME_TABLE

    DROP TABLE TBL
    CREATE TABLE TBL(
    ID NUMBER(10),
    CODE VARCHAR2(20),
    PARENT NUMBER(10)
    INSERT INTO TBL VALUES(1,'A',1);
    INSERT INTO TBL VALUES(2,'B',1);
    INSERT INTO TBL VALUES(3,'C',1);
    INSERT INTO TBL VALUES(4,'D',2);
    INSERT INTO TBL VALUES(5,'E',2);
    INSERT INTO TBL VALUES(6,'F',2);
    CREATE OR REPLACE PACKAGE pck_test IS
    TYPE t_rec IS RECORD(
    value1 NUMBER,
    value2 NUMBER,
    value3 NUMBER);
    TYPE t_tab IS TABLE OF pck_test.t_rec;
    FUNCTION calculate(i_id NUMBER) RETURN pck_test.t_tab
    PIPELINED;
    END pck_test;
    CREATE OR REPLACE PACKAGE BODY pck_test IS
    FUNCTION calculate(i_id NUMBER) RETURN pck_test.t_tab
    PIPELINED IS
    v_return t_rec;
    BEGIN
    v_return.value1 := 1 * i_id;
    v_return.value2 := 2 * i_id;
    v_return.value3 := 3 * i_id;
    PIPE ROW(v_return);
    RETURN;
    END;
    END pck_test;
    now I can use the pipelined function:
    SELECT 1 id, x.value1, x.value2, x.value3
    FROM TABLE(pck_test.calculate(1)) x
    id is hard-coded in this select with value 1
    I want to use TBL.id as the argument for the calculate function.
    I don't know how. I tried this...
    SELECT parent, ID, multi_values.value1, multi_values.value2, multi_values.value3
    FROM (
    SELECT ID, TABLE(pck_test.calculate(ID)) multi_values
    FROM TBL)
    Then the SELECT will be stored as a view.
    In an application, the view will be queried:
    select value1, value2, value3
    from view
    where parent = :parameter

  • Interactive Report using a View with a Pipelined Function

    Hello fellow Apex people,
    I'm Using Application Express 4.1.0.00.32
    I've got an interactive report that references a view (STOCK) and a pipelined function
    The basic query is listed below.
    SELECT S.CHANGED_TIME "Changed Time"
    , S.CHANGED_BY "Changed By"
    , S.ID "Id"
    , STKST_DESCRS.STOCK_STATUS_CODES "Stock Status Codes"
    , STKST_DESCRS.STOCK_STATUS_DESCRS "Stock Status"
    , S.ORIGINAL_CONTAINER "Original Container"
    FROM STOCK S
    , table(LWS_StkstStatus (S.ID)) STKST_DESCRS
    ORDER BY S.CO_ID,
    S.SEQUENCE_NUM;
    When the page is first run all the data is displayed correctly,
    If I define a filter, sort or a blank search the data from the pipelined function (STKST_DESCRS.) becomes null and isn't displayed.
    Does anyone know what is happening?
    Many Thanks

    I'm curious why you find this dangerous. I want a report that looks like this:
    Opportunity X:
    4 - 2-apr-2008 - Closed deal
    3 - 1-mar-2008 - Called Joe again
    2 - 12-feb-2008 - Called Joe
    1 - 14-jan-2008 - Initial call with customer.
    When you enter a new note, I want it to be numbered 5. The only problem I can imagine is someone deleting a note, which will almost never happen, and if it does, it just leaves a numbering gap. I don't see how using the function in a SELECT will accomplish this.

  • Use of Pipelined Function in Forms10g(10.1.0.2)...

    Hi ,
    I test the routines found in http://sheikyerbouti.developpez.com/recordset/record_set.htm
    I have a problem in the sample routine in Forms10g regarding pipelined function.
    Whereas , the whole routine database part and client side in SQL*PLUS works fine.... the client side on Forms10g does not.......
    I used two versions in when-button-pressed trigger:
    1)Declare
            cur SYS_REFCURSOR ;
    begin
           Open cur for SELECT * FROM  TABLE(Pkg_Cur_.Get_Raws2(CURSOR(SELECT * FROM EMP WHERE DEPTNO = 10)));
    end;
    The error message in compilation time is..
    Error 606: The subquery cursor is invalid in the client side
    and the second version is:
    2)Declare
          tab Pkg_Cur_.REC_EMP_;
    begin
           tab:=Pkg_Cur_.GET_RAWS2('SELECT * FROM EMP WHERE DEPTNO = 10');
    end;whereas the database package is defined as:
    CREATE OR REPLACE PACKAGE Pkg_Cur_
    IS
      TYPE REC_EMP_ IS TABLE OF EMP%ROWTYPE INDEX BY BINARY_INTEGER ;
      FUNCTION Get_Raws RETURN REC_EMP_ ;
      FUNCTION Get_Raws2 ( cur_lig IN SYS_REFCURSOR )
        RETURN TYPE_TAB_REC_EMP_ PIPELINED ;
    END  Pkg_Cur_ ;and the database package body is as follows:
    CREATE OR REPLACE PACKAGE BODY Pkg_Cur_
    IS
      FUNCTION Get_Raws RETURN REC_EMP_
      IS
         TAB REC_EMP_;
      BEGIN
         SELECT * BULK COLLECT INTO TAB FROM EMP ;
           RETURN TAB ;
      END ;
      FUNCTION Get_Raws2 ( cur_lig IN SYS_REFCURSOR )
      RETURN TYPE_TAB_REC_EMP_ PIPELINED
      IS
       Trec  TYPE_REC_EMP_ := TYPE_REC_EMP_(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL ) ;
       Remp  EMP%ROWTYPE ;
      BEGIN
       LOOP
         FETCH cur_lig INTO Remp ;
         EXIT WHEN cur_lig%NOTFOUND ;
           -- Handling datas --
           Trec.EMPNO    := Remp.EMPNO ;
           Trec.ENAME    := Remp.ENAME ;
           Trec.JOB      := Remp.JOB ;
           Trec.MGR      := Remp.MGR ;
           Trec.HIREDATE := Remp.HIREDATE ;
           Trec.SAL      := Remp.SAL * 1.1 ;
           Trec.COMM     := Remp.COMM ;
           Trec.DEPTNO   := Remp.DEPTNO ;
           -- Return value --
           PIPE ROW( Trec ) ;
       END LOOP ;
       RETURN ;
      END ;
    END  Pkg_Cur_ ;
    So , how the form trigger should be written...????
    If somebody could help me i would be grateful...!!!!
    Thanks a lot
    Simon

    In the second anonymous block you're trying to populate a record with a table. You would need to select from the function and either bulk collect into a table variable or fetch into a record variable in a loop. Bulk collect is also not supported on the client side.
    I've been looking at pipelined function possibilities in another thread:
    table functions
    The problem you have is actually with the Cursor functions, not the Pipelined functions.

  • Cannot query MSSQL system tables over db link created using DG4MSQL

    I am trying to create db link from Oracle 11g to SQL Server 2005 using DG4MSQL gateway. After creating db link I am not able to query MSSQL system views(sys.services or sys.objects) using JDBC driver. But I am able to query all user tables using JDBC driver. But if I use sqlplus, I am able to query all tables including system tables. Since my project is Java project, I am bound to use JDBC driver. One more observation I made is that, if I use DG4ODBC instead of DG4MSQL gateway, then I am able to query all MSSQL tables including system tables uding JDBC driver. Please let me know if there are any ways I can query MSSQL system tables using DG4MSQL and JDBC driver.
    Edited by: user13398705 on Dec 20, 2011 2:08 AM

    There's a bug in the JDBC driver and for 11.2.0.1 a fix is available on my Oracle Support -> look for fix 9496068 - it is a generic platform fix. According to the bug matrix this fix is also included in the 11.2.0.3 JDBC driver. Are you using this JDBC driver version?

  • Pipelined function, select from table t1 or t2 depending on user's choise

    Hi all,
    My need is to select data from table t1 or t2 depending on user's choise using pipelined function. You can find my first guess below. Maybe someone can help me to save some code, I mean getting the same result without writing "PIPE ROW" twice.
    FUNCTION fn_indicators (p_datbeg date, p_datend date, p_indicatorid number) return cl_risk_act pipelined IS
    v_obj cl_user_type;
    BEGIN
    case when p_indicatorid = 1 then
    FOR e IN (
    select trunc(sysdate-1) as adate, 0 as cid, 0 as indicatorid, '0' as code, '0' as indicatorname, 0 as value, 0 as cnt, '0' as cname from dual
    LOOP
    v_obj.adate              := e.adate;
    v_obj.cid                  := e.cid;
    v_obj.indicatorid       := e.indicatorid;
    v_obj.code               := e.code;
    v_obj.indicatorname  := e.indicatorname;
    v_obj.value              := e.value;
    v_obj.cnt                 := e.cnt;
    v_obj.cname            := e.cname;
    PIPE ROW (v_obj);
    END LOOP;
    when p_indicatorid = 2 then
    FOR e IN (
    select trunc(sysdate-2) as adate, 1 as cid, 1 as indicatorid, '1' as code, '1' as indicatorname, 1 as value, 1 as cnt, '1' as cname from dual
    LOOP
    v_obj.adate              := e.adate;
    v_obj.cid                  := e.cid;
    v_obj.indicatorid       := e.indicatorid;
    v_obj.code               := e.code;
    v_obj.indicatorname  := e.indicatorname;
    v_obj.value              := e.value;
    v_obj.cnt                 := e.cnt;
    v_obj.cname            := e.cname;
    PIPE ROW (v_obj);
    END LOOP;
    end case;
    RETURN;
    end;

    marco wrote:
    Justin,
    In my real code table real_t1 or pipelinedfn_t2 is joined to other tables, so surely real code is bigger than sample one. It is not wise to keep code twise with only one table name changed. I think about dynamic sql to choose from two tables:
    with t1 as
    (select * from real_t1
    t2 as
    (select * from pipelinedfn_t2
    t3 as (
    [dynamic selection of t1 or t2 depending on user's choise]
    select * from t3, t... where...I don't know correct syntax.
    Any ideas?
    >Justin,
    In my real code table real_t1 or pipelinedfn_t2 is joined to other tables, so surely real code is bigger than sample one. It is not wise to keep code twise with only one table name changed. I think about dynamic sql to choose from two tables:
    with t1 as
    (select * from real_t1
    t2 as
    (select * from pipelinedfn_t2
    t3 as (
    [dynamic selection of t1 or t2 depending on user's choise]
    select * from t3, t... where...I don't know correct syntax.
    Any ideas?
    Dynamic code does NOT scale.
    Making the tradeoff of smaller code size for reduced performance is not one that I would make.

  • Can i use create function for MSSql scalar and table valude function.

    Hi,
    1) Can i use create function for MSSql scalar and table valued function?
    2) How many type of user defined function are there in oracle 11g express?
    3) And can i reture any "type" form user defined function?
    yourse sincerely

    944768 wrote:
    Q1)That means even if i return predefined types like integer, varchar2 then also PGA is used ?The data type does not determine where the variable is stored. A string (called a varchar2 in Oracle) can be stored in stack space, heap space, on disk, in a memory mapped file, in a shared memory, in an atom table, etc.
    It is the who and what is defining and using that string, that determines where and how it is stored.
    The Oracle sever supports 2 languages in PL/SQL. The PL (Programming Logic) language is a procedural/declarative language. It is NOT SQL. SQL is integrated with it. The PL/SQL engine uses private process memory (PGA). So PL/SQL variables exist in the PGA (but there are exceptions such as LOBs).
    Q2) So please suggest me solution in oracle.Sounds to me you are looking at how to implement a T-SQL style function as an Oracle function, and once implemented, do joins on the function.
    Do not use PL/SQL in SQL in place of a SQL select. It is not T-SQL.
    One cannot use PL/SQL to create functions along the style of T-SQL, where the function executes a SQL using some conditional logic, and then return as if the function was a native SQL select.
    T-SQL is an extension to the SQL language - making it a hybrid and very impure language implementation. PL is based on ADA - part of the Pascal family of languages. The E-SQL (embedded SQL) approach used in languages like C/C++, Cobol and Ada, has been transparently done in PL/SQL. You can write and mix PL code and variables with SQL code. And the PL/SQL engine figures out how to make the call from the PL/SQL engine to the SQL engine.
    But PL/SQL is not "part" of the SQL language and does not "extend" the SQL language in a T-SQL fashion.
    So you need to check your SQL-Server preconcepts in at the door, as they are not only irrelevant in Oracle, they are WRONG in Oracle.
    The correct way in Oracle, in a nutshell - Use the SQL language to do data processing. Use PL/SQL to manage conditional process flow and the handling of errors.

  • Trouble using pipelined function in an select list lov query

    I'm trying to use a pipelined function in a select list lov query but i cet the error
    "LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query."
    my query is as follows :
    SELECT gt.navn d, gt.GEOGRAPHY_TYPE_ID r
    FROM GEOGRAPHY_TYPE gt
    WHERE gt.kode NOT IN (1)
    and gt.kode in (select lov_value from table(RAPPORT_FILTER_PKG.GET_RAPPORT_FILTER_VALUE_PIP (
    SYS_CONTEXT ('rapport_filter_ctx','filter_id'),'GEOGRAPHY_TYPES')) )
    ORDER BY gt.navn DESC
    if i use a discrete values '80' instead of the call to
    SYS_CONTEXT ('rapport_filter_ctx','filter_id')
    i don't get eny errors, but then the LOV isn't as dynamic as i has to be
    any idears???
    Edited by: [email protected] on Dec 1, 2008 8:50 AM
    Edited by: [email protected] on Dec 1, 2008 11:17 AM

    nope that doesn't do it either
    contains a syntax errror at
    SYS_CONTEXT (('rapport_filter_ctx',:P500_RAPPORT_FILTER_ID),'GEOGRAPHY_TYPES'))
    my theory is that it's got something to do with the way APEX binds values because
    the query
    SELECT gt.navn d, gt.GEOGRAPHY_TYPE_ID r
    FROM GEOGRAPHY_TYPE gt
    WHERE gt.kode NOT IN (1)
    and gt.kode in (select r from table(RAPPORT_FILTER_PKG.GET_RAPPORT_FILTER_VALUE_PIP ('80','GEOGRAPHY_TYPES')) )
    ORDER BY gt.navn DESC
    works fine in both TOAD and in APEX but as soon as i replace th '80' with :P500_RAPPORT_FILTER_ID then, apex won't accept the code??????
    Edited by: [email protected] on Dec 3, 2008 7:54 AM

Maybe you are looking for