Evalution routine in PL/SQL

We have one table day_fact(ID, Value, ...)
I have to generate user-defined results in same table with another ID.
How can I evaluate user-defined math. expression?
Which PL/SQL package's routine simply can calculate it?
I'm new to Oracle and OTN forums, therefore dint't know -- will your answers relays to me via e-mail or not. If not, send carbon copy to me. Thank You.

Hi .....
If I understand what you requirement is, you want an end user to be able to construct a mathematical expression that will be parsed and executed by Oracle using PL/SQL in a runtime environment.
If this is so, then you will probably want to use dynamic SQL.
There are two types of dynamic SQL. One using the DBMS_SQL supplied package and the newer native dynamic SQL. You will find a comparison at......
otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a76939/adg09dyn.htm#15124 Note: You may have to edit out the '<br>'s put in by the Forum code to get the URL to work. Also you may have append some of the URL which may be truncated, usually the bookmark(#nnnn).
A good explanation of native dynamic SQL with lots of code examples can be found at....
[URLotn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a77069/10_dynam.htm#4376[/URL] Note: You may have to edit out the '<br>'s put in by the Forum code to get the URL to work. Also you may have append some of the URL which may be truncated, usually the bookmark(#nnnn).
I find that native dynamic SQL is easier to use although I have used the DBMS_SQL for a long time.
DBMS_SQL also has the ability to accept very long source using a index-by (PL/SQL) table. An advantage in some cases. Oracle's documentation contains a lot about DBMS_SQL, but a good place to start is...
otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/appdev.817/a76936/dbms_sql.htm#998100 Note: You may have to edit out the '<br>'s put in by the Forum code to get the URL to work. Also you may have append some of the URL which may be truncated, usually the bookmark(#nnnn).
Hope this helps. Good Luck.

Similar Messages

  • How to call external Perl routines from Pl/SQL - Urgent

    Available software in the Test Environment:
    1. Sun Unix 2.8
    2. Oracle 8.1.7 ( 8i)
    3. Perl 5
    Iam trying to call/execute perl scripts from PL/SQL using the DEMO_RDBMS.mk. I am able to call C scripts from PL/SQL, but actually want to call Perl scripts.
    The steps followed for for C are -
    1. Create and compile a simple C program to execute a unix command (eg., touch a file).
    2. Make a shared library of the above compiled program (object), i.e., load the compiled object module into a dynamic load library.
    3. Declare the above library in Oracle using SQL*Plus.
    4. Define a PL/SQL function or procedure to call the external routine.
    5. Test the external routine.
    The above steps run good for a C program, but step 2 fails when run for a Perl script.
    When I tried to use the following command for step 2 -
    make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk extproc_callback \
    SHARED_LIBNAME=cmd_lib.so \
    OBJS=tst_cmd.pl
    got the following error -
    ld: fatal: file tst_cmd.pl: unknown file type.
    ld: fatal: File processing errors. No output written t cmd_lib.so
    *** Error code 1
    This gives me an indication that demo_rdbms.mk does not understand/interpret Perl scripts. Going through the demo_rdbms.mk suggests the same.
    My questions is - How do we call external Perl scripts/routines from PL/SQL ??
    Do I have to get a different version of "demo_rdbms.mk" ?
    PS: The perl scripts used above (tst_cmd.pl) is error free and works as intended in the unix environment.

    Iam trying to call/execute perl scripts from PL/SQL using the DEMO_RDBMS.mk. I am able to call C scripts from PL/SQL, but actually want to call Perl scripts. Well, C is a "compiler" language and Perl is interpreted. In a sense, C is not "scripts".
    When I tried to use the following command for step 2 -
    make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk extproc_callback \
    SHARED_LIBNAME=cmd_lib.so \
    OBJS=tst_cmd.pl
    got the following error -
    ld: fatal: file tst_cmd.pl: unknown file type.
    ld: fatal: File processing errors. No output written t cmd_lib.soI guess this compiles an extproc "stub" with your object file, generating an external procedure. So the object file really needs to be an object file :-)
    My questions is - How do we call external Perl scripts/routines from PL/SQL ??I'd guess you need an embedded Perl interpreter in the external procedure.
    Not much help though I'm afraid :-/
    Cheers
    Fredrik

  • How to provide the license key after having the evaluation copy expired for SQL Server 2012 Standard?

    How to provide the license key after having evaluation copy expired for SQL Server 2012 Standard?
     I couldn’t figure out how to provide the license key after having
    evaluation copy expired for SQL Server 2012 Standard
     Thank you
     Best
     Jamal

    The following blog is on the topic: Upgrading from SQL Server 2012 Evaluation Edition
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Need help on passing an array to  java routine from PL/SQL

    I got a math routine in java and the idea is have an array of integer and the java routine does some computatoin and then pass the array back to pl/sql
    and I google the web most code is calling pl/sql from java but not the other way round. any help will be really appreciated.
    {code}
    package tst;
    import java.util.*;
    public class plsql3 {
            private final static int factor1 = 2;
            public static void getFib2(int[] in, int[] out, int k){
                            for (int i=0;i<=k-1;i++){
                    out[i]= in[i] * factor1;
      public static void main(String[] arg){
         int[] in2 = {1,2,3,4,5};
         int[] out2= {0,0,0,0,0};
         getFib2(in2,out2,2);
         for ( int j = 0 ; j <= out2.length-1;j++) {
                    System.out.println(out2[j]);
    {code}
    {code}
    CREATE or replace PROCEDURE getfib5 (x IN OUT numlist, y IN OUT numlist, k in number)
    AS LANGUAGE JAVA
    NAME 'tst.plsql3.getFib2(int[], int[],int)';
    set serveroutput on format wraped;
    declare
      in2 numlist := numlist(1,2,3,4,5,6);
      out2 numlist := numlist(0,0,0,0,0,0);
    begin
    --in2(0) := 1;
    --in2(1) := 2;
    --in2(2) := 3 ;
    for i in 1..in2.count
      loop
        dbms_output.put_line(in2(i));
      end loop;
       for i in 1..in2.count
      loop
        dbms_output.put_line(out2(i));
      end loop;
      getFib5(in2,out2,2);
      for i in 1..in2.count
      loop
        dbms_output.put_line(in2(i));
      end loop;
       for i in 1..in2.count
      loop
        dbms_output.put_line(out2(i));
      end loop;
    --dbms_output.put_line(in2.count);
    end;
    {code}
    {code}
    javac -source 1.5 -target 1.5 tst/plsql3.java
    {code}
    Error report:
    ORA-00932: inconsistent datatypes: expected a value at argument position 1 that is convertible to a Java int got an Oracle named TYPE (ADT, REF etc)
    ORA-06512: at "TK1.GETFIB5", line 1
    ORA-06512: at line 18
    00932. 00000 -  "inconsistent datatypes: expected %s got %s"
    *Cause:   
    *Action:

    http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:3696816290928

  • Evaluation Period has expired - SQL server Management Studio

    I am new to this environment and I have an issue with SQL  studio management – it says
    “Evaluation period has expired. For information on how  to upgrade your evaluation software please go to
    http://www.microsoft.com/sql/howtobuy”.
    The questions I have are :
    1. How do I know what version of SQL I am running ?(since I cant go through studio management)
    2. I can see sql server 2008 r2 on the program files- does that mean SQL management studio is 2008 R2?
    3. How do I upgrade to a proper version ? – Is it through “installation center “ on program files ?
    4. Will the upgrade stop any SQL services?
    Many thanks guys – Im fairly new to sql troubleshooting – I have only done direct installations in the past.
    Regards, MassonTech

    Hi Guys
    Many Thanks for your reply.
    I have managed to find the version of SQL server 2008 R2  running through the registry and it says :
    Edition: Standard  Edition
    Edition Type : Standard Edition
    But i can not find any indication that an evaluation copy was initialy installed. - I have been asked to suggest an upgrade path. My question is ? am i upgrading just SQL management studio ? or SQL server 2008 R2.
    Also , if SQL is expired - i presume something should stop working (in terms of database etc) But in my enviroment  - everything seems fine except the error message when you try to lunch SQL management studio.
    Regards, MassonTech
    I guess you have multiple instances or versions of SQl server installed on your machine.Please use below link to run a discovery report and paste result here so that we can understand
    http://blogs.msdn.com/b/petersad/archive/2009/11/13/sql-server-2008-discovery-report.aspx
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers
    I have performed the above, please see below the output - Please could you advise on what next?
    Product
    Instance
    Feature
    Lanugauge
    Edition
    Version
    Sql Server 2008
    DAV01
    Database Engine Serveices
    1033
    Standard
    10.0.1600.22
    Sql Server 2008
    DAV01
    SQL Server Replication
    1033
    Standard
    10.0.1600.22
    Sql Server 2008
    DAV01
    Analysis Services
    1033
    Standard
    10.0.1600.22
    Sql Server 2008 R2
    Management tools basic
    1033
    Enterprise Evaliation
    10.50.1600.1
    Sql Server 2008 R2
    Management tools Complete
    1033
    Enterprise Evaliation
    10.50.1600.1
    Sql Server 2008 R2
    Integration Services
    1033
    Enterprise Evaliation
    10.50.1600.1
    Regards, MassonTech

  • Evaluation period has expired SQL 2014

    Today we have started getting this error when we try to open SQL Server 2014 Management Studio.The install was done using the correct media with the appropriate product key.
    I have:
    Gone through the process of an Edition Upgrade on all my Instances and Shared Features
    Uninstalled Shared Features and reinstalled.
    Tried editing the registry key, CommonFiles from 1 to 3 under
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\120\ConfigurationState (120 as this is an install of SQL 2014). I have also tried switching this back to 1 and re-running the Upgrade.
    I have rebooted the server several times but I am still not able to open the Management Studio.
    I notice this was an issue in 2008 but I cannot find any fixes for 2014.
    Thanks.

    Hi,
    Below support article is applicable to 2014 as well
    https://support.microsoft.com/en-us/kb/971268?wa=wsignin1.0
    after changing Registry did you performed points 7 and 8
    7. Rerun the edition upgrade procedure to complete the upgrade of all the components to a licensed edition.
    8. After the edition upgrade is complete, refer to the following Knowledge Base article to prevent issues with future updates to the instance.
    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
    My Technet Wiki Article
    MVP
    With the exception of point 8 I have followed these steps and am not having any joy. The REG value is changed to 3 and I have rerun on all instances and also the shared components. I have rebooted but still receive the error

  • Problems calling external C routines from PL/SQL

    Hi everybody!
    I'm not familiar with C programming in Unix, but I'm trying to make work an example to execute external procedures (developed in C) from PL/SQL.
    The example includes .c and .pc source files, which I have compiled succesfully.
    After that, links the .o files into .so to declare later as libraries in the Oracle database.
    The problem appears when I try to execute this procedures (from PL), when a I get the error:
    "Error loading external library"
    "ORA-06522: ld.so.1: ORACLE_HOME/bin/extprocPLSExtProc: fatal:
    relocation error: file /opt/mqm/lib/libmqm.so: symbol NULL_HSHMEMS: referenced symbol not found"
    The library /opt/mqm/lib/libmqm.so is provided with the installation of MQSeries Server.
    Thanx in advance.
    Luisa.

    Here is what works on my system:
    TNSNAMES.ORA:
    EXTPROC_CONNECTION_DATA.WORLD =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    LISTENER.ORA:
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /home/oracle/Ora9i)
    (PROGRAM = extproc)

  • SQL Server 2012 Standard saying its Evaluation period has expired

    We installed SQL 2012 Standard on a server and have since created a 1TB SQL server database.  Suddenly, we started receiving an error when opening the SQL management Studio that our evaluation period has expired.  We purchased 2 licenses of Standard
    2012 and installed it on two servers.  One is working fine, and the other is saying it had an evaluation copy.
    According to our VLSC account, there isn't a product key required, so I can't run the edition upgrade to upgrade it to standard.  Is there a way we can get the license converted without risking the 1TB database we created?

    Hello,
    Sometimes the media provided when you buy the licenses have the product key prepidded. You may find the product key shows by itself
    when you reach the Product Key page of SQL Server setup. Please try that?
    An edition upgrade won’t delete any data or configuration of the SQL Server instance. Please read the following article:
    http://www.sqlcoffee.com/SQLServer2012_0015.htm
    In some cases, even when you have performed an edition upgrade to a licensed edition, you still get that evaluation edition error message.
    If that is the case, please read the following thread:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/9e50de75-6119-4963-8d5e-9d8b0367bc8e/evaluation-period-has-expired-sql-2012-ssms?forum=sqlsetupandupgrade 
    (Allen Li)
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Showing column value as counter in sql query - report

    I created a classic report with search bar based on an sql query. I would like to show the "notes" column in this query using some sort of counter and as a hyperlink to another section on the page (same idea as footnotes in a book). So if I have 10 rows and 5 have "notes". I should show 1,2,3,4,5 in the notes column for those rows and the number gets displayed as a link to another section listing the notes 1 through 5.
    I was thinking of creating a hidden page item as the counter with value of 0 and then in my query doing counter+1 but i'm not sure how to do this or if i can do that...
    If anyone can help or have any other ideas I would really appreciate it!!
    Thanks,
    Hindy

    Well, I'm doing this in VB and the subquery is dynamic. I'm passing an ADO recordset to a routine that sets up a listview to display the results. The number of columns selected can vary. My idea was to size the columns appropriately based on the size of the data. Within the display routine I could:
    sql = "SELECT "
    for i = 0 to oRS.Fields.Count - 1
    sql = sql & "MAX(LENGTH(" & i & ")), "
    next 'i
    sql = sql & "FROM (" & oRS.Source & ")"

  • SQL*Loader and binary data

    i have a C routine that builds SQL*Loader input files. the input files contain multiple records, with a couple of integer columns and a raw(1400) field. the control file specifies a record separator of '|', which seems weird (having text in the middle of raw data) but also is somewhat co-operative (see below).
    so i basically write each integer to the file, then a short (2-byte) length value for the raw field, then the raw field. then the '|' separator.
    i've noticed that if the size of raw field is 400 bytes or less, everything works fine, i get the correct number of records in the database.
    unfortunately, with a size of 401 or more, SQL*Loader parses the thing into twice as many records as it should. so if i've written 3 records to my input data file, with each record's raw field at 400 bytes or less i get 3 records loaded. but any with a raw field of 401+, i get two records for each.
    any ideas why? and how to correct this? also, any ideas on a better way to do this? all the examples of large data in the online doc and the o'reilly book favor showing examples with large character data, which does me not much good.
    tia. john

    i have a C routine that builds SQL*Loader input files. the input files contain multiple records, with a couple of integer columns and a raw(1400) field. the control file specifies a record separator of '|', which seems weird (having text in the middle of raw data) but also is somewhat co-operative (see below).
    so i basically write each integer to the file, then a short (2-byte) length value for the raw field, then the raw field. then the '|' separator.
    i've noticed that if the size of raw field is 400 bytes or less, everything works fine, i get the correct number of records in the database.
    unfortunately, with a size of 401 or more, SQL*Loader parses the thing into twice as many records as it should. so if i've written 3 records to my input data file, with each record's raw field at 400 bytes or less i get 3 records loaded. but any with a raw field of 401+, i get two records for each.
    any ideas why? and how to correct this? also, any ideas on a better way to do this? all the examples of large data in the online doc and the o'reilly book favor showing examples with large character data, which does me not much good.
    tia. john

  • Full-text search not available after upgrade from SQL 2008 R2 Std to SQL 2012 Std

    We upgraded our production SQL Server from 2008 R2 Std to 2012 Std last week, and the installation logs show everything was successful, but now we are unable to do any searches against our full-text indexes.  The resulting error is as follows:
    "Full-Text Search is not installed, or a full-text component cannot be loaded."
    When executing the query "SELECT FULLTEXTSERVICEPROPERTY('ISFULLTEXTINSTALLED')", the result is "0".  The "Full-Text Daemon Launcher service is also running.  When running installation again to add the feature, it shows
    "Full-Text and Semantic Extractions for Search" as being installed and unavailable for selection in the list of features to add.  As a side note, we did the same upgrade in our identical QA environment before production and everything was successful
    and full-text searches are working correctly.  We have run the "Repair" routine in the SQL Installation Center and it did not correct the problem.
    The full-text catalogs still appear when browsing through the GUI in SSMS or querying sys.fulltext_indexes and sys.fulltext_index_columns.  It is not possible to view the properties of the catalog in SSMS, though, as the GUI throws an error and an empty
    dialog box is shown.  Any other thoughts?
    Thanks,
    AJ

    I have no idea what is going, but assuming that it is a little pressing to get this fix, I think the best path in this case is to open a case with Microsoft.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • WRITTING AN UPLOAD ROUTINE

    I have oracle portal but wish to write an upload routine in pl/sql and run as a link component (url link).
    My procedure will do the following :-
    I want the user to browse the their file system and choose a file and then upload to the portal30.wwdoc_document table. I then want to call a procedure passing the name of the file uploaded to it.
    Does anybody have examples of how to do this.
    I know how to upload a file using content area in portal but want a stored procedure which will be called from my poprtal app menu.
    Any comments will be really helpfull.

    I can retrieve info regarding a file that exists, that part of the code works fine, but if I execute the procedure I get the following error message:-
    ORA-06550: line 2, column 1:
    PLS-00306: wrong number or types of arguments in call to 'TEST_UPLOAD'
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored (WWV-11230)
    Failed to parse as PORTAL30 - begin
    "PORTAL30"."TEST_UPLOAD";
    end; (WWV-08300)
    my code
    p_file IN VARCHAR2)
    as
    begin
    if p_file is null then
    htp.formOpen(
    curl => 'http://halifax.wira.explor.co.uk/pls/test1/test_upload',
    cattributes => 'enctype="multipart/form-data"');
    htp.p('<INPUT TYPE="FILE" NAME="p_file">');
    htp.formSubmit;
    htp.formClose;
    else
    htp.p('Uploaded File Information');
    htp.hr;
    htp.p('Name:' &#0124; &#0124; p_file);
    for i in (
    select *
    from portal30.wwdoc_document
    where name = p_file
    ) loop
    htp.p('File Name:' &#0124; &#0124; i.filename);
    htp.br;
    htp.p('Size: ' &#0124; &#0124; i.doc_size);
    htp.br;
    htp.p('Mime Type: ' &#0124; &#0124; i.mime_type);
    end loop;
    end if;
    end;
    Question - How do I get the browse button part to work so I can upload ?
    Thanks in anticipation.

  • Management Studio won't open after evaluation

    I installed SQL Server 2012 on my own computer as an evaluation copy to test.  Now we have purchased SQL Server 2012 and have installed it on our network.  I now want to connect to the network server, but when I try to open 2012 Management Studio
    to connect to it, it just keeps saying my evaluation is expired and directs me to the Microsoft website to purchase.  I didn't think I needed to purchase a license for my PC to connect to the instance on the server.  Do I?  Is there a way to
    reset this?  Do I have to reinstall Management Studio?

    Hello,
    Please read the following resource.
    https://support.microsoft.com/kb/971268?wa=wsignin1.0
    https://social.technet.microsoft.com/Forums/sqlserver/en-US/9e50de75-6119-4963-8d5e-9d8b0367bc8e/evaluation-period-has-expired-sql-2012-ssms?forum=sqlsetupandupgrade
    (Allen Li – MSFT)
    Hope this helps.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • SQL Server License

    Hi Guys,
                   We have installed the CRM 5.0 development  and production server with the databae of MS SQL. While Installing CRM 5.0 we have installed the evaluation period of MS SQL . Servers were working fine from few months ,Suddenly the evaluation period of MS SQL server has got expired .So we have uninstalled the SQL and reinstalled SQL server. After that if i try to start sap service it is not connectiong to the database.
                           Can any body suggest me to how to attach SQL  to the existing sap database.
        Please give me ur valuable suggestions at earliest as possible.
                                Currect Solutions provided by anybody will be awarded with full points.
    Regards
    Prakash K

    Hi,
    you can follow note 151603 to get the database attached again. You should use the STM tools mentioned in Section 8 to do the post attach actions. After running the STM tools you should be able to start the system.
    Regards
      Clas

  • Sql Anywhere product road map

    Hello, all
    Our company is about to start a new large project soon.
    Several DB providers are being evaluated, among them SAP SQL Anywhere.
    Since this is going to be a product line for the next 15-20 years, we need to know if SAP has road map for SQL Anywhere.
    The vagueness of SQL anywhere  future is currently the biggest drawback for us, since technically it is an excellent solution.
    If anyone can point me to the product road map, it would very helpful.
    Thank you
    Arcady

    Hi Arcady,
         As far as I know, SQL Anywhere is alive and well.  In addition to being offered as an product for sale to end users and OEMs, it is part of, or included with, many other SAP solutions.  For example, SQL Anywhere is included as part of Business Objects and the SAP Mobile Platform, and SQL Anywhere data synchronization (MobiLink) is currently in beta as a new offering for the Hana Cloud Platform.
    There is a recent product roadmap for SQL Anywhere posted on SAP Service Marketplace, which you should be able to access if you have an account.
    Development is continuing on SQL Anywhere and a new release is planned for this year (I don't believe a firm date has been announced yet).
    Hopefully this information helps to address your concerns.  If not, please feel free to contact me directly if you have any further questions about the future of SQL Anywhere (firstname dot lastname at sap dot com).
    --Jason Hinsperger
    Sr. Product Manager
    SAP

Maybe you are looking for

  • HP Laptop won't talk to HP OfficejetPro 8600 on network

    Screwey probblem: The printer is 'conneectd' to the cable modem.  (The printer tells me this.) The HP  laptop is 'connected to the cable modem.  (Or I wouldn't be able to connect to the internet.) They will not talk to each other wirelessley but will

  • Battery worse After mountain lion 10.8.1 update?

    Anybody else? Indicated battery life worse w 10.8.1 m-2011 i7 256G 11" MBA here, new last Christmas. Had two different fully-charged values for same conditions prior to update, 2:31 and 2:10 ( both corresponding to ca. 97% and Service Battery status.

  • Parallel Processing in ODI with Unique Requirement

    Hi All, I have a unique requirement. I have a scenerio which i have to run multiple times in parallel with different user inputs. Eg Suppose user inputs A,B,C then i have to run the same scenerio 3 times with input filter as A B and C respectively in

  • TS3694 why i restore ios 7 error 3004?

    i have error 3004 restore

  • Can I install Reader via GPO

    Hello, I've got an organisation (about 100 PC's/Laptop) that has multiple versions of the Reader software, going back to 8.1.0.  I'd like to get everybody up to the same version, but the quantity (and geographic locations) of machines means that's al