Creating user defined function in sql server 2000

I have created a udf an i want to call it in another udf. will u please help me out how to create.
thank you

And you ask that in an ORACLE forum? Brilliant idea... ;)

Similar Messages

  • How to create user defined metrics for SQL Server target?

    The customer is not able to create a user defined metrics for SQL Server target.
    This is very important for him to use this product.
    He is asking how to create user defined metrics?
    I sent him Note 304952.1 How to Create a User-Defined SQL Metric in EM 10g Grid Control
    But it would work for an Oracle DB, but his target is SQL Server DB
    Not able to find the "User-Defined Metrics" link from Database home page.
    How to create user defined metrics for SQL Server target?

    http://download-uk.oracle.com/docs/cd/B14099_19/manage.1012/b16241/Monitoring.htm

  • How to Use Sequence Object Inside User-defined Function In SQL Server

    I'm trying to call sequence object inside SQL Server user-defined function. I used 
    Next Value for dbo.mySequence  to call the next value for my sequence created. But I'm getting an error like below.
    "NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views, user-defined functions, user-defined aggregates, user-defined table types, sub-queries, common table expressions, or derived tables."
    Is there any standard way to call sequence inside a function?
    I would really appreciate your response.
    Thanks!

    The NEXT
    VALUE FOR function cannot be used for User Defined function. It's one of the limitation.
    https://msdn.microsoft.com/en-us/library/ff878370.aspx
    What are you trying to do? Can you give us an example and required output?
    --Prashanth

  • User define function for SQL Server

    Hi all,
    it's possible to write an UDF for SQL Server in Java?
    I know that it is possible with DB2 and Oracle.
    My main goal is to write an UDF that works well with all of these DB.
    Thank's

    Hi all,
    it's possible to write an UDF for SQL Server in
    Java?Okay, JDBC can talk to any database (given you have a driver implementation). Also, JDBC is like a conduit. So the real question is likely, will your database let you do this?
    I know that it is possible with DB2 and Oracle.
    My main goal is to write an UDF that works well with
    all of these DB.I also don't know what a UDF is, but if you ARE talking about stored procedures, then no, it's not possible. All databases are different. On that note, I typically recommend NEVER using stored procedures unless absolutely necessary.
    But it also sounds like you want to do this at runtime. I've seen systems that do this (bind stored procs at runtime dynamically) and it's a freakin nightmare! So be careful.

  • Want to convert function in SQL Server 2000

    Hi ,
    i am writing this function in oracle.Could you please convert this function in SQL Server 2000 because i am new in this and dont know how to use decode function in sql.
    Please following is the code for oracle.
    CREATE OR REPLACE function fun ( localex varchar2,titlex varchar2)
    return number
    as  x number;
    begin
    select sum ( decode (count (username),max(prereq_count),1,0) ) x into x from
       SELECT
                       prereq_count,
                       username
                 FROM
                         table1
    group by     username ;
    return x;
    end fun;
    Regards
    Vishal

    Just take a look example below might give you idea :
    create or replace function f_makeAddress_tx (
    i_address_tx VARCHAR2,
    i_city_tx VARCHAR2,
    i_state_tx VARCHAR2,
    i_zip_tx VARCHAR2)
    return VARCHAR2
    is
    e_badZip EXCEPTION; u279E8
    pragma EXCEPTION_init(e_badZip,-20998); u279E9
    v_out_tx VARCHAR2(256);
    begin
    p_validateZip (i_zip_tx); u279E12
    v_out_tx:= i_address_tx||u2019, u2018|| u279E13
    i_city_tx ||u2019, u2018||
    i_state_tx ||u2019, u2018||
    i_zip_tx;
    return v_out_tx; u279E17
    exception
    when e_badZip then u279E19
    return i_zip_tx || u2018: Invalid zip code.u2019;
    end;
    Regards,
    Clint

  • Using User Defined Function is SQL

    Hi
    I did the following test to see how expensive it is to use user defined functions in SQL queries, and found that it is really expensive.
    Calling SQRT in SQL costs less than calling a dummy function that just returns
    the parameter value; this has to do with context switchings, but how can we have
    a decent performance compared to Oracle provided functions?
    Any comments are welcome, specially regarding the performance of UDF in sql
    and for solutions.
    create or replace function f(i in number) return number is
    begin
      return i;
    end;
    declare
      l_start   number;
      l_elapsed number;
      n number;
    begin
      select to_char(sysdate, 'sssssss')
        into l_start
        from dual;
      for i in 1 .. 20 loop
        select max(rownum)
          into n
          from t_tdz12_a0090;
      end loop;
      select to_char(sysdate, 'sssssss') - l_start
        into l_elapsed
        from dual;
      dbms_output.put_line('first: '||l_elapsed);
      select to_char(sysdate, 'sssssss')
        into l_start
        from dual;
      for i in 1 .. 20 loop
        select max(sqrt(rownum))
          into n
          from t_tdz12_a0090;
      end loop;
      select to_char(sysdate, 'sssssss') - l_start
        into l_elapsed
        from dual;
      dbms_output.put_line('second: '||l_elapsed);
      select to_char(sysdate, 'sssssss')
        into l_start
        from dual;
      for i in 1 .. 20 loop
        select max(f(rownum))
          into n
          from t_tdz12_a0090;
      end loop;
      select to_char(sysdate, 'sssssss') - l_start
        into l_elapsed
        from dual;
      dbms_output.put_line('third: '||l_elapsed);
    end;
    Results:
       first: 303
       second: 1051
       third: 1515
    Kind regards
    Taoufik

    I find that inline SQL is bad for performance but
    good to simplify SQL. I keep thinking that it should
    be possible somehow to use a function to improve
    performance but have never seen that happen.inline SQL is only bad for performance if the database design (table structure, indexes etc.) is poor or the way the SQL is written is poor.
    Context switching between SQL and PL/SQL for a User defined function is definitely a way to slow down performance.
    Obviously built-in Oracle functions are going to be quicker than User-defined functions because they are written into the SQL and PL/SQL engines and are optimized for the internals of those engines.
    There are a few things you can do to improve function
    performance, shaving microseconds off execution time.
    Consider using the NOCOPY hints for your parameters
    to use pointers instead of copying values. NOCOPY
    is a hint rather than a directive so it may or may
    not work. Optimize any SQL in the called function.
    Don't do anything in loops that does not have to be
    done inside a loop.Well, yes, but it's even better to keep all processing in SQL where possible and only resort to PL/SQL when absolutely necessary.
    The on-line documentation has suggested that using a
    DETERMINISTIC function can improve performance but I
    have not been able to demonstrate this and there are
    notes in Metalink suggesting that this does not
    happen. My experience is that DETERMINISTIC
    functions always get executed. There's supposed to
    be a feature in 11g that acually caches function
    return values.Deterministic functions will work well if used in conjunction with a function based index. That can improve access times when querying data on the function results.
    You can use DBMS_PROFILER to get run-time statistics
    for each line of your function as it is executed to
    help tune it.Or code it as SQL. ;)

  • How to create user defined functions in xi.

    how to create user defined functions in xi.
    can anyone give info with screen shots.

    Hi,
    Please follow the  steps mentioned in below link
    http://help.sap.com/saphelp_nw04/helpdata/en/f8/2857cbc374da48993c8eb7d3c8c87a/frameset.htm
    also refer below links to know more about UDF
    udf
    Thanks
    Swarup
    Edited by: Swarup Sawant on Mar 3, 2008 3:59 PM

  • Creating a connection pool using SQL Server 2000, Sun ONE Application Serve

    Has any one succesfully configured SQL Server 2000 to work with Sun ONE Application Server 7 on Windows 2000 server service pack 4? I am embarking on a new J2EE project and I need to configure it as soon as possible.
    The problem I am having is that, when I ping the data souce name, there is a connection error.
    I have set the data source name and other details as follows:
    Under JDBC, I have set the parameters for the connection pool as follows:
    Data Source Name:      com.microsoft.jdbc.sqlserver.SQLServerDriver
    Database Name:          jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Test
    User:               test
    Password:          test
    In the JVM settings page, I have set the prefix class path as follows for the location of the Microsoft JDBC
    drivers that I downloaded as follows:
    c:\microsoft\drivers/lib/msbase.jar
    c:\microsoft\drivers/lib/msutil.jar
    c:\microsoft\drivers/lib/mssqlserver.jar
    Under JVM Options, there is a strange setting which I don't understand: perhaps this is the cause of the
    connction error?
    -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver
    Please help????

    I'm in a similar boat...
    Trying to setup AS7 JDBC and followed the instructions on the link you provided and get the following exception. I kept the case the same, thinking 'setpassword" was incorrect, so I tried changing the property to "Password", but get the same exception but it points to "setPassword" instead.
    SEVERE: RAR5041:Cannot get jdbc connection
    com.sun.enterprise.repository.J2EEResourceException
    java.lang.NoSuchMethodException: setpassword
    at com.sun.enterprise.repository.JdbcConnectionPool.createDataSource(JdbcConnectionPool.java:243)
    at com.sun.enterprise.resource.JdbcUrlAllocator.createResource(JdbcUrlAllocator.java:80)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:856)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:416)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:625)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520)
    at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263)
    at com.sun.enterprise.resource.JdbcXAConnection.<init>(JdbcXAConnection.java:74)
    at com.sun.enterprise.resource.Jdbc10XaAllocator.createResource(Jdbc10XaAllocator.java:94)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:856)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:416)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:625)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520)
    at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263)
    at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:170)
    at com.sun.enterprise.resource.JdbcDataSource.internalGetConnection(JdbcDataSource.java:241)
    at com.sun.enterprise.resource.JdbcDataSource.getConnection(JdbcDataSource.java:98)
    at com.rvi.database.jdbcConnection.getConnection(jdbcConnection.java:93)
    at com.webapp.database.ArticlesDAO.selectByYear(ArticlesDAO.java:102)
    at com.webapp.actions.ArticleAction.list(ArticleAction.java:96)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)

  • How to use create-default-dbms-tables in SQL Server 2000

    Hi everyone,
    I'm new in EJB development. I'm trying to deploy a CMP to Weblogic 8.1 SP1 using
    JBuilderX. I configured a ConnectionPool and DataSource to allow the CMP to access
    the SQL Server 2000. However, I cannot deploy the CMP if I didn't create the table
    in SQL Server manually. Does anyone know how to use the create-default-dbms-tables?

    Refer to
    http://e-docs.bea.com/wls/docs81/ejb/DDreference-cmp-jar.html#1162249
    "Keith" <[email protected]> wrote:
    >
    Hi everyone,
    I'm new in EJB development. I'm trying to deploy a CMP to Weblogic 8.1
    SP1 using
    JBuilderX. I configured a ConnectionPool and DataSource to allow the
    CMP to access
    the SQL Server 2000. However, I cannot deploy the CMP if I didn't create
    the table
    in SQL Server manually. Does anyone know how to use the create-default-dbms-tables?

  • Cant create connection Pool for MS SQL Server 2000 with Microsoft Driver

    i am using bea weblogic server 6.1, i cant create connection pool while using MS
    SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft website. when
    i give the following class name for JDBC driver and the connection url and click
    apply while selecting the available server, a number of exception appears in default
    server (that is the connection pool cannot be created..... cannot load the driver
    class).
    URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
    Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
    when i use the above setting in a JDBC simple application in Jbuilder
    7.0 the application runs successfully and fetches the data deom MS SQL database
    but in at Bea connection Pool is not created with these settings. i do give appropriate
    username and password in properties field in connection pool. Thankx for any help!

    khabbab wrote:
    That was the original code part from "startweblogic" :
    :runWebLogic
    echo on
    set PATH=.\bin;%PATH%
    set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;
    echo off
    and i changed it to :
    :runWebLogic
    echo on
    set PATH=.\bin;%PATH%
    set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;D:\Program Files\Microsoft
    SQL Server 2000 Driver for JDBC\lib\msbase.jar;D:\Program Files\Microsoft SQL
    Server 2000 Driver for JDBC\lib\msutil.jar;D:\Program Files\Microsoft SQL Server
    2000 Driver for JDBC\lib\mssqlserver.jar;I suggest moving or copying the three ms driver jars to a directory that has no blanks
    in it so the classpath doesn't have blanks in it. Ie:
    go to the "D:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib"
    directory and do this:
    mkdir D:\microsoft_jdbc_driver
    cp *.jar D:\microsoft_jdbc_driver
    Then make the classpath include D:\microsoft_jdbc_driver\msbase.jar etc.
    Joe
    >
    >
    echo off
    when i save and run the bat file, server appears then disappears.
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    The class path which is echoed at server startup does not include thepaths to
    driver jar files. when i edited the "startweblogic.bat" file and includedthe
    driver class paths to jar files, now the server doesnot even run. tellme what
    to do now???Show me what change you made to the startweblogic file.
    Joe
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    kindly tell me how can i check that the class paths for driver jarfiles are included
    in that string? thanks. also tell me can not i use the jdriver forsql server
    2000?.The startup script will echo what it's doing, including printing out
    the classpath
    it will use. Yes you can use the jDriver for MS SQL2000. It is sufficient
    for
    basic JDBC, but the MS drivfer is preferable in some ways.
    Joe
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    i am using bea weblogic server 6.1, i cant create connection
    pool
    while
    using MS
    SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft
    website.
    when
    i give the following class name for JDBC driver and the connectionurl and click
    apply while selecting the available server, a number of exception
    appears
    in default
    server (that is the connection pool cannot be created..... cannot
    load
    the driver
    class).The server startup script creates a string that will become the
    classpath
    for the server.
    This string is part of the java call to start the server with a-classpath
    argument. You need to
    make sure the MS driver jars are part of that classpath string.
    Joe
    URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
    Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
    when i use the above setting in a JDBC simple applicationin Jbuilder
    7.0 the application runs successfully and fetches the data deom
    MS
    SQL database
    but in at Bea connection Pool is not created with these settings.
    i
    do give appropriate
    username and password in properties field in connection pool.
    Thankx
    for any help!
    khabbab wrote:
    The class path which is echoed at server startup does not include thepaths to
    driver jar files. when i edited the "startweblogic.bat" file and includedthe
    driver class paths to jar files, now the server doesnot even run. tellme what
    to do now???
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    kindly tell me how can i check that the class paths for driver jarfiles are included
    in that string? thanks. also tell me can not i use the jdriver forsql server
    2000?.The startup script will echo what it's doing, including printing out
    the classpath
    it will use. Yes you can use the jDriver for MS SQL2000. It is sufficient
    for
    basic JDBC, but the MS drivfer is preferable in some ways.
    Joe
    Joseph Weinstein <[email protected]_this> wrote:
    khabbab wrote:
    i am using bea weblogic server 6.1, i cant create connection
    pool
    while
    using MS
    SQL Server 2000. i have installed JDBC Driver SAP1 from microsoft
    website.
    when
    i give the following class name for JDBC driver and the connectionurl and click
    apply while selecting the available server, a number of exception
    appears
    in default
    server (that is the connection pool cannot be created..... cannot
    load
    the driver
    class).The server startup script creates a string that will become the
    classpath
    for the server.
    This string is part of the java call to start the server with a-classpath
    argument. You need to
    make sure the MS driver jars are part of that classpath string.
    Joe
    URL= jdbc:Microsoft:sqlserver://127.0.0.1:1433;DatabaseName=MyDB
    Driver= com.microsoft.jdbc.sqlserver.SQLServerDriver
    when i use the above setting in a JDBC simple applicationin Jbuilder
    7.0 the application runs successfully and fetches the data deom
    MS
    SQL database
    but in at Bea connection Pool is not created with these settings.
    i
    do give appropriate
    username and password in properties field in connection pool.
    Thankx
    for any help!

  • Creating a connection to MS SQL Server 2000...

    Hi ,
    Using the :
    1)Oracle SQL Developer 1.1.3 and 1.2.1 ,
    2)MS SQL Server 2000 - both db and agent are running ,
    I cannot create a connection to MS SQL Server (error: "Failure - Network Error IO Exception : Connection refused : connect").
    Both software - and Oracle DB , as well- have been installed on the same server(Win XP) and i have deactivated the firewall , without the desired result....
    Also the server is standalone and does have a static IP Address....
    What can I do ...????
    Thanks....
    Sim

    I have also downloaded and installed the SQL Developer 1.5.0.53.
    When i declare the same settings to SQL SERVER DB - as in the other SQL Developer versions(1.1.3 and 1.2.1)- I get a different error message..:
    "Failure - Cannot connect to SQL Server on localhost" - whereas in the other versions i get[i] "Failure - Network Error IO Exception : Connection refused : connect".
    When i declare another host name (one that does not exist , for example "localhost1") then the error message is :"Failure : Unknown host name localhost1".
    So ,the above tests may show that the error seems to be in the port setting....however , i cannot verify it since the port setting is 1433 - the one i declare in the connection.
    Do you have an idea....????
    I would be grateful if somebody could provide some 'light'.....!!!!
    Sim

  • How to convert Oracle User defined datatype to SQL Server 2014 using SSMA Version 6.0

    I am trying to convert Oracle 11g OE schema to SQL Server 2014, using SSMA version 6.0
    Getting an error in converting the Oracle View to SQL Server
    CREATE OR REPLACE VIEW OC_CUSTOMERS OF OE.CUSTOMER_TYP WITH OBJECT IDENTIFIER (customer_id) AS
    SELECT c.customer_id, c.cust_first_name, c.cust_last_name, c.cust_address,
               c.phone_numbers,c.nls_language,c.nls_territory,c.credit_limit,
               c.cust_email,
               CAST(MULTISET(SELECT o.order_id, o.order_mode,
                                   MAKE_REF(oc_customers,o.customer_id),
                                   o.order_status,
                                   o.order_total,o.sales_rep_id,
                                   CAST(MULTISET(SELECT l.order_id,l.line_item_id,
    l.unit_price,l.quantity,
    MAKE_REF(oc_product_information,
    l.product_id)
    FROM order_items l
    WHERE o.order_id = l.order_id)
                                        AS order_item_list_typ)
                             FROM orders o
                             WHERE c.customer_id = o.customer_id)
                    AS order_list_typ)
         FROM customers c
    *   SSMA error messages:
    *   O2SS0461: Conversion of object view is not supported.
    *   OF OE.CUSTOMER_TYP
    *      WITH OBJECT IDENTIFIER (customer_id)
    CREATE VIEW dbo.OC_CUSTOMERS
    AS
       /*Generated by SQL Server Migration Assistant for Oracle version 6.0.0.*/
       *   SSMA error messages:
       *   O2SS0481: Conversion of statement containing user defined type column 'c.cust_address' not supported.
       *   O2SS0481: Conversion of statement containing user defined type column 'c.phone_numbers' not supported.
       *   O2SS0430: Conversion of multiset conditions is not supported.
       *   CAST(MULTISET
       *      SELECT
       *         o.order_id,
       *         o.order_mode,
       *         MAKE_REF(oc_customers, o.customer_id),
       *         o.order_status,
       *         o.order_total,
       *         o.sales_rep_id,
       *         CAST(MULTISET
       *               SELECT
       *                  l.order_id,
       *                  l.line_item_id,
       *                  l.unit_price,
       *                  l.quantity,
       *                  MAKE_REF(oc_product_information, l.product_id)
       *               FROM order_items  l
       *               WHERE o.order_id = l.order_id
       *            ) AS order_item_list_typ)
       *      FROM orders  o
       *      WHERE c.customer_id = o.customer_id
       *   ) AS order_list_typ)
       SELECT
          c.CUSTOMER_ID,
          c.CUST_FIRST_NAME,
          c.CUST_LAST_NAME,
          c.cust_address,
          c.phone_numbers,
          c.NLS_LANGUAGE,
          c.NLS_TERRITORY,
          c.CREDIT_LIMIT,
          c.CUST_EMAIL,
          NULL
       FROM dbo.CUSTOMERS  AS c   */
    Any suggestion on converting this view would be helpful.
    Kind regards.

    Thanks Lydia Zhang for your reference urls.
    Please let me know if you come across any reference articles related to
    Creating a SQL Server table and View with columns as SQL Server TVP similar to Oracle UDT like
      CREATE TABLE "OE"."CUSTOMERS"
       (    "CUSTOMER_ID" NUMBER(6,0),
        "CUST_FIRST_NAME" VARCHAR2(20 BYTE) CONSTRAINT "CUST_FNAME_NN" NOT NULL ENABLE,
        "CUST_LAST_NAME" VARCHAR2(20 BYTE) CONSTRAINT "CUST_LNAME_NN" NOT NULL ENABLE,
        "CUST_ADDRESS" "OE"."CUST_ADDRESS_TYP" ,
        "PHONE_NUMBERS" "OE"."PHONE_LIST_TYP" ,
        "NLS_LANGUAGE" VARCHAR2(3 BYTE),
    And also creating a SQL Server TVP inside an another SQL Server TVP as in Oracle
    create or replace TYPE customer_typ
     AS OBJECT
        ( customer_id        NUMBER(6)
        , cust_first_name    VARCHAR2(20)
        , cust_last_name     VARCHAR2(20)
        , cust_address       cust_address_typ
       , credit_limit       NUMBER(9,2)
        , cust_email         VARCHAR2(30)
        , cust_orders        order_list_typ
    NOT FINAL;
    Kind regards.
    Venkatesha

  • Create user defined type under SQL type

    Hello guys,
    I have a table PART_NEEDED and a table function which returns table of PART_NEEDED%ROWTYPE. This works fine but if I try to create new user defined type with with the same attributes as PART_NEEDED and pipe the rows into table of that type I am getting an inconsistency of types error - Error(30,16): PLS-00382: expression is of wrong type.
    Please refer to the script below. I appreciate any help!
    CREATE TABLE "TOSS"."PART_NEEDED"
    "PART_NEEDED_ID" NUMBER NOT NULL ENABLE,
    "TYPE_OF_PART_NEEDS_ID" NUMBER,
    "TYPE_OF_PART_IS_NEEDED_ID" NUMBER,
    "AMOUNT" NUMBER
    SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
    INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
    TABLESPACE "USERS" ;
    CREATE OR REPLACE TYPE "TYPE_PART_NEEDED" AS OBJECT
    ID NUMBER,
    PART_ID NUMBER,
    SUB_PART_ID NUMBER,
    AMOUNT NUMBER
    create or replace package KOLEV_ADMIN_PKG as
    TYPE TYPE_PART_NEEDED_TBL IS TABLE OF TOSS.TYPE_PART_NEEDED; -- if the type here is PART_NEEDED%ROWTYPE it works perfectly fine
    FUNCTION GET_SUBPARTS (IN_PART_ID IN NUMBER)
    RETURN TYPE_PART_NEEDED_TBL PIPELINED;
    end;
    CREATE OR REPLACE PACKAGE BODY "KOLEV_ADMIN_PKG" AS
    FUNCTION GET_SUBPARTS (IN_PART_ID IN NUMBER)
    RETURN TYPE_PART_NEEDED_TBL PIPELINED
    IS
    R_TBL TYPE_PART_NEEDED_TBL; -- To be returned
    BEGIN
    FOR R IN (
    WITH
    SUBPARTS(ID, PART_ID, SUBPART_ID, AMOUNT) AS
    SELECT PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT
    FROM PART_NEEDED
    WHERE TYPE_OF_PART_NEEDS_ID = IN_PART_ID
    UNION ALL
    SELECT PN.PART_NEEDED_ID, PN.TYPE_OF_PART_NEEDS_ID, PN.TYPE_OF_PART_IS_NEEDED_ID, PN.AMOUNT
    FROM SUBPARTS SP, PART_NEEDED PN
    WHERE PN.TYPE_OF_PART_NEEDS_ID = SP.SUBPART_ID
    SELECT SP.ID, SP.PART_ID, SP.SUBPART_ID, SP.AMOUNT
    FROM SUBPARTS SP
    ORDER BY PART_ID
    LOOP
    PIPE ROW(R); -- Error(30,16): PLS-00382: expression is of wrong type
    END LOOP;
    RETURN;
    END GET_SUBPARTS;
    END "KOLEV_ADMIN_PKG";
    INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('4', '2', '3', '2')
    INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('5', '3', '1', '2')
    INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('3', '2', '1', '4')
    INSERT INTO "TOSS"."PART_NEEDED" (PART_NEEDED_ID, TYPE_OF_PART_NEEDS_ID, TYPE_OF_PART_IS_NEEDED_ID, AMOUNT) VALUES ('17', '3', '4', '1')
    Database Release 11.2.0.1.0
    I want this functionality because I need to make some joins and add descriptions for each part. Now this table PART_NEEDED contains only IDs - many to many.
    Regards!
    Edited by: Todor Kolev on Mar 3, 2012 12:47 PM

    CREATE OR REPLACE
      PACKAGE BODY KOLEV_ADMIN_PKG
        AS
          FUNCTION GET_SUBPARTS (IN_PART_ID IN NUMBER)
            RETURN TYPE_PART_NEEDED_TBL PIPELINED
            IS
            BEGIN
                FOR R IN (
                          WITH SUBPARTS(ID, PART_ID, SUBPART_ID, AMOUNT)
                            AS (
                                 SELECT  PART_NEEDED_ID,
                                         TYPE_OF_PART_NEEDS_ID,
                                         TYPE_OF_PART_IS_NEEDED_ID,
                                         AMOUNT
                                   FROM  PART_NEEDED
                                   WHERE TYPE_OF_PART_NEEDS_ID = IN_PART_ID
                                UNION ALL
                                 SELECT  PN.PART_NEEDED_ID,
                                         PN.TYPE_OF_PART_NEEDS_ID,
                                         PN.TYPE_OF_PART_IS_NEEDED_ID,
                                         PN.AMOUNT
                                   FROM  SUBPARTS SP,
                                         PART_NEEDED PN
                                   WHERE PN.TYPE_OF_PART_NEEDS_ID = SP.SUBPART_ID
                          SELECT  TYPE_PART_NEEDED(
                                                   SP.ID,
                                                   SP.PART_ID,
                                                   SP.SUBPART_ID,
                                                   SP.AMOUNT
                                                  ) O
                            FROM  SUBPARTS SP
                            ORDER BY PART_ID
                         ) LOOP
                  PIPE ROW(R.O);
                END LOOP;
                RETURN;
          END GET_SUBPARTS;
    END KOLEV_ADMIN_PKG;
    /SY.

  • Call userdefined function on sql server 2000 from a rpt/crystalviewer CR11

    Post Author: schste0
    CA Forum: Data Connectivity and SQL
    Hi, i have userdefined functions in an sql2k database and look for a way to use them in cr11 and in the reportviewer with RAS. Thx in advance.

    Use a SQL Expression if the Driver supports it. Or a Command Object.

  • How do I modify a user-defined function in SQL Plus

    I have created some functions in my database. Can anybody tell me how to modify/edit those functions?

    PS C:\> $Class2 = New-Object MyTest.Class1
    PS C:\> $Class2
    MyString Struct1Property Struct2Property
    MyTest.Struct1 MyTest.Class1+Struct2
    PS C:\> $Struct2 = New-Object MyTest.Class1+Struct2
    PS C:\> $Struct2.Property = "X"
    PS C:\> $Struct2
    Property
    X
    PS C:\> $Class2.Struct2Property = $Struct2
    PS C:\> $Class2.Struct2Property.Property
    XPS C:\> $Struct2.GetType()
    IsPublic IsSerial Name                                     BaseType                                                                    
    False    False    Struct2                                  System.ValueType                                                            
    Struct2 is a valuetype, (by value)
    The classes are by reference
    PS C:\> $Struct3 = $Class2.Struct2Property
    PS C:\> $Struct3
    Property
    X
    PS C:\> $Struct3.Property = "Y"
    PS C:\> $Class2.Struct2Property.Property
    X
    PS C:\> $Class2.MyString = "A"
    PS C:\> $Class3 = $Class2
    PS C:\> $Class3.MyString = "B"
    PS C:\> $Class2.MyString
    B

Maybe you are looking for

  • Error in MView Creation

    Hi, I am using the below command to create a Mview (Orace 10.2.0.3 )... SQL> CREATE MATERIALIZED VIEW MRKT.IP_D 2 ORGANIZATION HEAP PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING 3 STORAGE(INITIAL 5242880 NEXT 5242880 MINEXTENTS 1 M

  • Keep getting pop up adds. how to remove malware

    Using Crome keep getting pop up adds. ***?

  • THE LEFT SIDE OF MY "PASSCODE" KEYBOARD IS NOT WORKING..WHAT TO DO?????

    Like I said, the left side of my passcode keyboard doesnt function..... And i need it because one of my numbers is "1"...how can i make it work?????

  • Manage controls based on user

    Hi, How to manage controls based on login user . Ex : if admin i want to hide some components and if user i want to show some components like menu items, buttons etc Thanks, Nitesh

  • Cannot create playlist on iPad Mini

    When I try to create a playlist on my iPad Mini, it tells me I have no music. http://i.imgur.com/XxTN1xx.png But I do. http://i.imgur.com/eeNgJ2j.png 5.1 GB of it http://i.imgur.com/xZNA92N.png Does anyone know how to fix this? I want to put all my s