Need help with PL/SQL functions

Hi,
Is there a way to compare if a set of elements is present in another set using some function?
Example: Is it possible to find out if all words present in 'BANQUE SAFRA SA' is present in 'BANQUE JACOB SAFRA (SUISSE) SA' using some function in Oracle 9i?
Any suggestion would be appreciated.
Thank you,
Anushree

Boneist,
your solution would giv "false positives":
SQL> with my_tab as (select 'BANQUE JACOB SAFRA (SUISSE) SA' col1 from dual union all
  2                  select 'BANQUE SAFRA (SUISSE) SB' col1 from dual union all
  3                  select 'BANQUE SAFRA SA' col1 from dual union all
  4                  select 'BANQUE SAFRANE SA' col1 from dual)
  5  -- end of mimicking your data. USE SQL below!
  6  select * from my_tab
  7  where col1 like replace('BANQUE SAFRA SA', ' ', '%');
COL1
BANQUE JACOB SAFRA (SUISSE) SA
BANQUE SAFRA SA
BANQUE SAFRANE SA  Here is a PL/SQL funcion that does not expect the words in the specific order:
SQL> DECLARE
  2     FUNCTION strInStr(
  3        a   IN   VARCHAR2,
  4        b   IN   VARCHAR2)
  5        RETURN VARCHAR2
  6     IS
  7        i          PLS_INTEGER;
  8        startpos   PLS_INTEGER;
  9        endpos     PLS_INTEGER;
10        word       VARCHAR2(4000);
11     BEGIN
12        FOR i IN 1 .. LENGTH(a) - LENGTH(REPLACE(a, ' ')) + 1 LOOP
13           startpos := INSTR(' ' || a, ' ', 1, i);
14           endpos := INSTR(a || ' ', ' ', 1, i);
15           word := SUBSTR(a, startpos, endpos - startpos);
16
17           IF ' ' || b || ' ' NOT LIKE '% ' || word || ' %' THEN
18              RETURN 'N';
19           END IF;
20        END LOOP;
21
22        RETURN 'Y';
23     END;
24  BEGIN
25     DBMS_OUTPUT.put_line(strInStr('BANQUE SAFRA SA', 'BANQUE JACOB SAFRA (SUISSE) SA'));
26     DBMS_OUTPUT.put_line(strInStr('SAFRA BANQUE SA', 'BANQUE JACOB SAFRA (SUISSE) SA'));
27     DBMS_OUTPUT.put_line(strInStr('BANQUE SAFRA FRANCE', 'BANQUE JACOB SAFRA (SUISSE) SA'));
28     DBMS_OUTPUT.put_line(strInStr('QUE SAFRA SA', 'BANQUE JACOB SAFRA (SUISSE) SA'));
29  END;
30  /
Y
Y
N
N

Similar Messages

  • Need help with a sql function...

    Hi.
    I have a year '2004' stored in a variable and I want to be able to add the rest of the date before this. How would I go about adding
    01-APR to the front of this year and then put it in a variable...
    thanks in advance.

    var number := 2004;
    dat date := to_date('01-APR-'||var, 'DD-MON-YYYY');

  • Need help with user defined function

    Hello SDN,
    I need some help with a user-defined function. My source message contains multiple
    generic records (1000 char string), and my target message is 1 header record,
    then multiple generic records.  See description of source and target messages below:
    Source:
      GenericRecordTable 1..unbounded
        Row (1000 char string)
    Target:
      Field1 (char5)
      Field2 (char5)
      Field3 (char5)
      IT_Data
        GenericRecordTable 1..unbounded
          Row (1000 char string)
    Basically, what I need to do in my user defined funtion is to map the first record
    in my source record to the 3 header fields, then map all of the rest of the records
    (starting from line 2) into the GenericRecordTable.
    Can someone please help me with the code for the user defined function(s) for this
    mapping?
    Thank you.

    hi,
    Activities
    1. To create a new user-defined function, in the data-flow editor, choose Create New Function (This
    graphic is explained in the accompanying text), which is located on the lower left-hand side of the
    screen. In the menu, choose Simple Function or Advanced Function.
    2. In the window that appears, specify the attributes of the new function:
    Name
    Technical name of the function. The name is displayed in the function chooser and on the data-flow
    object.
    Description
    Description of how the function is used.
    Cache
    Function type (see above)
    Argument Count
    In this table, you specify the number of input values the function can process, and name them. All
    functions are of type String.
    3. In the window that appears, you can create Java source code:
    a. You can import Java packages to your methods from the Imports input field, by specifying them
    separated by a comma or semi-colon:
    You do not need to import the packages java.lang., java.util., java.io., and java.lang.reflect. since
    all message mappings require these packages and therefore import them. You should be able to
    access standard JDK and J2EE packages of the SAP Web Application Server by simply specifying the
    package under Import. In other words, you do not have to import it as an archive into the Integration
    Repository. You can also access classes of the SAP XML Toolkit, the SAP Java Connector, and the
    SAP Logging Service (see also: Runtime Environment (Java-Mappings)).
    In addition to the standard packages, you can also specify Java packages that you have imported as
    archives and that are located in the same, or in an underlying software component version as the
    message mapping.
    b. Create your Java source text in the editor window or copy source text from another editor.
    4. Confirm with Save and Close.
    5. User-defined functions are limited to the message mapping in which you created the function. To
    save the new function, save the message mapping.
    6. To test the function, use the test environment.
    The new function is now visible in the User-Defined function category. When you select this category,
    a corresponding button is displayed in the function chooser pushbutton bar. To edit, delete, or add the
    function to the data-flow editor, choose the arrow next to the button and select from the list box
    displayed.
    http://help.sap.com/saphelp_nw04/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm
    http://java.sun.com/j2se/1.5.0/docs/api/
    /people/krishna.moorthyp/blog/2006/07/29/documentation-html-editor-in-xi
    /people/sap.user72/blog/2006/02/06/xi-mapping-tool-exports
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    UDF -
    http://help.sap.com/saphelp_nw04/helpdata/en/22/e127f28b572243b4324879c6bf05a0/content.htm
    Regards

  • Power Query for Excel - Need Help with Oracle SQL Syntax

    Hello everyone,
    I am new to Power Query and am not able to figure this out.  I am trying to pull in data into my Excel spreadsheet using a specific Oracle SQL query.  While in query editor, how do I take the Oracle.Database function and add my SQL statement? 
    I already know what I want, I don't want it to download all the table names.  According to the help page, I should be able to do this but it does not provide a syntax example
    Also, I don't understand what "optional options as nullable record" means.
    Below is what function and arguments the help page notes.  How do I use this?
    Oracle.Database(server as text, optional options as nullable record) as table
    Any help is greatly appreciated.
    Thank you,
    Jessica

    When I try this, I get an error 
    DataSource.Error: Oracle: Sql.Database does not support the query option 'Query' with value '"Select * from Owner.View_Name"'. Details: null
    I'm trying to download oracle data from a view into power query - Power Query navigator does not list th eviews from my source, it lists only the tables. When I try write sql statements, it throws me the above
    error. This is what I tried
     Oracle.Database("Source/Service",[Query="Select * from Owner.View_Name"])
    Any ideas how to fix this? 

  • Need help with a SQL qurey that returns multiple rows for one record?

    I have the following query where I use a CASE WHEN clause to determine the date of a shift that begins with "FRLO" on day1 - day14 of the pay period. It works great if a schedule record contains one day that begins "FRLO", but if more than one day is "FRLO" then it only returns the first day it finds and not the others. Is there some way to get the query to return a ron for every day 1 - 14 that begins "FRLO"? System if Oracle 11G
    Order of the results is not important as this is part of a larger query that orders the results.
    Thanks in advance for any help,
    George
    SELECT s.empid,
    CASE
    WHEN UPPER (SUBSTR (s.Day1, 0, 4)) = 'FRLO'
    THEN
    pp.startpp
    WHEN UPPER (SUBSTR (s.Day2, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 1
    WHEN UPPER (SUBSTR (s.Day3, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 2
    WHEN UPPER (SUBSTR (s.Day4, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 3
    WHEN UPPER (SUBSTR (s.Day5, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 4
    WHEN UPPER (SUBSTR (s.Day6, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 5
    WHEN UPPER (SUBSTR (s.Day7, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 6
    WHEN UPPER (SUBSTR (s.Day8, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 7
    WHEN UPPER (SUBSTR (s.Day9, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 8
    WHEN UPPER (SUBSTR (s.Day10, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 9
    WHEN UPPER (SUBSTR (s.Day11, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 10
    WHEN UPPER (SUBSTR (s.Day12, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 11
    WHEN UPPER (SUBSTR (s.Day13, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 12
    WHEN UPPER (SUBSTR (s.Day14, 0, 4)) = 'FRLO'
    THEN
    pp.startpp + 13
    END
    startdate,
    NULL starttime,
    NULL endtime,
    8 hours,
    0 minutes
    FROM schedules s
    JOIN
    payperiods pp
    ON pp.periodid = s.periodid
    WHERE UPPER (SUBSTR (s.Day1, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day2, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day3, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day4, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day5, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day6, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day7, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day8, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day9, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day10, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day11, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day12, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day13, 0, 4)) = 'FRLO'
    OR UPPER (SUBSTR (s.Day14, 0, 4)) = 'FRLO';
    CURRENT OUTPUT
    EMPID STARTDATE STARTTIME ENDTIME HOURS MINUTES
    753738, 3/25/2013 , , ,8 ,0
    753740, 3/25/2013 , , ,8 ,0
    753748, 3/25/2013 , , ,8 ,0
    DESIRED OUTPUT
    EMPID STARTDATE STARTTIME ENDTIME HOURS MINUTES
    753738, 3/25/2013 , , ,8 ,0
    753740, 3/25/2013 , , ,8 ,0
    753748, 3/25/2013 , , ,8 ,0
    753738, 3/26/2013 , , ,8 ,0
    753740, 3/26/2013 , , ,8 ,0
    753740, 3/28/2013 , , ,8 ,0
    753748, 1/1/2013 , , ,8 ,0
    753738, 4/3/2013 , , ,8 ,0
    753748, 4/3/2013 , , ,8 ,0
    CREATE TABLE SCHEDULES
    SCHEDULEID NUMBER(12) NOT NULL,
    EMPID NUMBER(12) NOT NULL,
    PERIODID VARCHAR2(6 BYTE) NOT NULL,
    AREAID NUMBER(12) NOT NULL,
    DAY1 VARCHAR2(50 BYTE),
    DAY2 VARCHAR2(50 BYTE),
    DAY3 VARCHAR2(50 BYTE),
    DAY4 VARCHAR2(50 BYTE),
    DAY5 VARCHAR2(50 BYTE),
    DAY6 VARCHAR2(50 BYTE),
    DAY7 VARCHAR2(50 BYTE),
    DAY8 VARCHAR2(50 BYTE),
    DAY9 VARCHAR2(50 BYTE),
    DAY10 VARCHAR2(50 BYTE),
    DAY11 VARCHAR2(50 BYTE),
    DAY12 VARCHAR2(50 BYTE),
    DAY13 VARCHAR2(50 BYTE),
    DAY14 VARCHAR2(50 BYTE),
    NOPTIND1 INTEGER DEFAULT 0,
    NOPTIND2 INTEGER DEFAULT 0,
    NOPTIND3 INTEGER DEFAULT 0,
    NOPTIND4 INTEGER DEFAULT 0,
    NOPTIND5 INTEGER DEFAULT 0,
    NOPTIND6 INTEGER DEFAULT 0,
    NOPTIND7 INTEGER DEFAULT 0,
    NOPTIND8 INTEGER DEFAULT 0,
    NOPTIND9 INTEGER DEFAULT 0,
    NOPTIND10 INTEGER DEFAULT 0,
    NOPTIND11 INTEGER DEFAULT 0,
    NOPTIND12 INTEGER DEFAULT 0,
    NOPTIND13 INTEGER DEFAULT 0,
    NOPTIND14 INTEGER DEFAULT 0
    CREATE TABLE PAYPERIODS
    PERIODID VARCHAR2(6 BYTE) NOT NULL,
    STARTPP DATE,
    ENDPP DATE
    Insert into SCHEDULES
    (SCHEDULEID, EMPID, PERIODID, AREAID, DAY1,
    DAY2, DAY3, DAY4, DAY5, DAY6,
    DAY7, DAY8, DAY9, DAY10, DAY11,
    DAY12, DAY13, DAY14, NOPTIND1, NOPTIND2,
    NOPTIND3, NOPTIND4, NOPTIND5, NOPTIND6, NOPTIND7,
    NOPTIND8, NOPTIND9, NOPTIND10, NOPTIND11, NOPTIND12,
    NOPTIND13, NOPTIND14)
    Values
    (3693744, 753738, '082013', 2167, 'X',
    'FRLO<1530>', 'FRLO<1530>', '1530', '1530', '1530',
    'X', 'X', '1530', '1530', 'FRLO',
    '1530', '1530', 'X', 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0);
    Insert into SCHEDULES
    (SCHEDULEID, EMPID, PERIODID, AREAID, DAY1,
    DAY2, DAY3, DAY4, DAY5, DAY6,
    DAY7, DAY8, DAY9, DAY10, DAY11,
    DAY12, DAY13, DAY14, NOPTIND1, NOPTIND2,
    NOPTIND3, NOPTIND4, NOPTIND5, NOPTIND6, NOPTIND7,
    NOPTIND8, NOPTIND9, NOPTIND10, NOPTIND11, NOPTIND12,
    NOPTIND13, NOPTIND14)
    Values
    (3693745, 753740, '082013', 2167, 'X',
    'FRLO<1530>', 'FRLO<1530>', '1530', 'FRLO', '1530',
    'X', 'X', '1530', '1530', '1530',
    '1530', '1530', 'X', 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0);
    Insert into SCHEDULES
    (SCHEDULEID, EMPID, PERIODID, AREAID, DAY1,
    DAY2, DAY3, DAY4, DAY5, DAY6,
    DAY7, DAY8, DAY9, DAY10, DAY11,
    DAY12, DAY13, DAY14, NOPTIND1, NOPTIND2,
    NOPTIND3, NOPTIND4, NOPTIND5, NOPTIND6, NOPTIND7,
    NOPTIND8, NOPTIND9, NOPTIND10, NOPTIND11, NOPTIND12,
    NOPTIND13, NOPTIND14)
    Values
    (3693746, 753748, '082013', 2167, 'X',
    'FRLO<1530>', '1530', '1530', '1530', '1530',
    'X', 'X', 'FRLO<1530>', '1530', 'FRLO',
    '1530', '1530', 'X', 0, 0,
    0, 0, 0, 0, 0,
    0, 0, 0, 0, 0,
    0, 0);
    COMMIT;
    Insert into PAYPERIODS
    (PERIODID, STARTPP)
    Values
    ('082013', TO_DATE('03/24/2013 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;

    Do you have the opportunity to change the data model to have one day per row ? It would make this easier to get this result without the need for a 14-way CASE or UNION.
    If not...
    The case statement will return as soon as it matches one of the conditions. Since you want a match when any column in the row starts with FRLO you can use a UNION ALL treating each column as a separate result. There may be more efficient ways to do this, but here is one way:
    Select S.Empid,       Pp.Startpp Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day1, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+1 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day2, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+2 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day3, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+3 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day4, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+4 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day5, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+5 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day6, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+6 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day7, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+7 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day8, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+8 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day9, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+9 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day10, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+10 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day11, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+11 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day12, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+12 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day13, 0, 4)) = 'FRLO'
    Union All 
    Select S.Empid,       Pp.Startpp+13 Startdate,       Null Starttime,       Null Endtime,       8 Hours,       0 Minutes
      From Schedules S       Join  Payperiods Pp On Pp.Periodid = S.Periodid
      Where Upper (Substr (S.Day14, 0, 4)) = 'FRLO'

  • Need Help With Save As function Very Important

    i working on a project and i have to create a Save As function for it. When you click on Save As its supposed to open a dialog window where u can choose the where you would like to save the file and what you would like to name it. I know there is alot wrong with my code but i'm not sure on how to fix it so any and all help is greatly appreciated
    private void doSaveAs(){
              //display file dialog
              FileDialog fDialog2 = new FileDialog (this, "Save As...", FileDialog.SAVE);
              fDialog2.setVisible(true);
              //Set the file name chosen by user
              String name = fDialog2.getFile();
              // user canceled file selection, return without doing anything.
              if(name == null)
                   return;
              fileName = fDialog2.getDirectory() + name;
              // Try to create a file writer
              FileWriter writer = null;
              try{
                   writer = new FileWriter(fileName);
              } catch (IOException ioe){
                   MessageDialog dialog = new MessageDialog (this, "Error Message",
                             "Error writing the file: "+ioe.toString());
                   dialog.setVisible(true);
                   return;
              BufferedWriter bWriter = new BufferedWriter(writer);
              //Try to write the file
              StringBuffer textBuffer = new StringBuffer();
              try {
                   String textLine = bWriter.write(2);
                   while (textLine != null) {
                        textBuffer.append(textLine + '\n');
                        textLine = bWriter.write(name);
                   bWriter.close();
                   writer.close();
              } catch (IOException ioe){
                   MessageDialog dialog = new MessageDialog (this, "Error Message", "Error writing file: "+ioe.toString());
                   dialog.setVisible(true);
                   return;
         setTitle("JavaEdit " +name);     // reset frame title
         text.setText(textBuffer.toString());
    null

    And again with indentation
       private void doSaveAs(){
       //display file dialog
       FileDialog fDialog2 = new FileDialog (this, "Save As...",     
       FileDialog.SAVE);
          fDialog2.setVisible(true);
       //Set the file name chosen by user
       String name = fDialog2.getFile();
       // user canceled file selection, return without doing anything.
       if(name == null)
          return;
       fileName = fDialog2.getDirectory() + name;
       // Try to create a file writer
       FileWriter writer = null;
          try{
             writer = new FileWriter(fileName);
          } catch (IOException ioe){
          MessageDialog dialog = new MessageDialog (this, "Error Message", "Error writing the file: "+ioe.toString());
                dialog.setVisible(true);
                return;
       BufferedWriter bWriter = new BufferedWriter(writer);
       //Try to write the file
       StringBuffer textBuffer = new StringBuffer();
       try {
          String textLine = bWriter.write(2);
          while (textLine != null) {
             textBuffer.append(textLine + '\n');
             textLine = bWriter.write(name);
          bWriter.close();
          writer.close();
       } catch (IOException ioe){
          MessageDialog dialog = new MessageDialog (this, "Error Message", "Error writing file: "+ioe.toString());
          dialog.setVisible(true);
          return;
       setTitle("JavaEdit " +name); // reset frame title
       text.setText(textBuffer.toString());
    }

  • Need help with MS SQL server JDBC driver

    Anyone has experience getting ACS working with SQL2005? We keep getting ‘com.adobe.adept.persist.DatabaseException: java.sql.SQLException: No suitable driver’
    We’re using sqljdbc.jar and sqljdbc4.jar that downloaded from Microsoft website. We added this to every library folder under tomcat, JRE and SDK but it did not help. Any suggestion will be helpful.
    Thanks-

    Hi,
    We have ACS with SQL Server 2005 Std correctly working.
    We have this settings:
    ############ SQL Server Connection ############
    com.adobe.adept.persist.sql.driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
    com.adobe.adept.persist.sql.connection=jdbc:sqlserver://ip-addressSQL:PortSQL;databaseName =Adept
    com.adobe.adept.persist.sql.dialect=microsoft
    com.adobe.adept.persist.sql.user=userSQL
    com.adobe.adept.persist.sql.password=passSQL
    Wi use Microsoft SQL Server JDBC Driver 3.0 downloaded from Microsoft website (http://www.microsoft.com/download/en/details.aspx?id=21599)
    Good luck,

  • Newbie - need help with a SQL query for a bar chart

    Hi,
    I'm a new user on APEX with no real SQL knowledge and I'm trying to build a dashboard with charts into an existing APEX application. Based on another application, I have come up with the following SQL code:
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORY
    Order by COUNT(PROJECT_ID) DESC
    The code from the other app was:
    select null link
    , FUNCTIONAL_AREA label
    , count (decode(PROJECT_STATUS,'Active',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'Complete',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'On Hold',PROJECT_ID)) "On Hold"
    , count (decode(PROJECT_STATUS,'Recurring',PROJECT_ID))"Recurring"
    , count (decode(PROJECT_STATUS,'Pipeline',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'Not Approved',PROJECT_ID))"Not Approved"
    from PM_V2
    where LOB='S2S' and (FUNCTIONAL_AREA='Accounts Payable' or FUNCTIONAL_AREA='Expense' or FUNCTIONAL_AREA='Procurement' or FUNCTIONAL_AREA='Fixed Assets')
    group by FUNCTIONAL_AREA
    Order by COUNT(PROJECT_ID) DESC
    I'm getting a "Failed to parse SQL query!" error when I try to run validation.
    Is this enough info for some assistance? Any help would really be appreciated.
    Thanks,
    Rachel

    Hello,
    This is more of an SQL question, rather than specifically APEX-related. It's notable that you say: I'm a new user on APEX with no real SQL knowledgeWhich is fine (we all have to start somewhere, afterall) but it might be worth de-coupling the problem from APEX in the first instance. I'd also strongly recommend either taking a course, reading a book (e.g. http://books.google.co.uk/books?id=r5vbGgz7TFsC&printsec=frontcover&dq=Mastering+Oracle+SQL&hl=en#v=onepage&q=Mastering%20Oracle%20SQL&f=false) or looking for a basic SQL tutorial - it will save you a whole lot of heartache, I promise you. Search the oracle forums for the terms "Basic SQL Tutorial" and you should come up with a bunch of results.
    Given that you've copied your query template from another, I would suggest ensuring that the actual query works first of all. Try running it in either:
    * SQL Editor
    * SQL*Plus
    * an IDE like SQL Developer (available free from the OTN: http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html ) or TOAD or similar.
    You may find there are syntax errors associated with the query - it's difficult to tell without looking at your data model.
    select null link
    , CATEGORY label
    , count (decode(PROJECT_STATUS,'1',PROJECT_ID))"Active"
    , count (decode(PROJECT_STATUS,'2',PROJECT_ID))"Complete"
    , count (decode(PROJECT_STATUS,'3',PROJECT_ID))"On Hold"
    , count (decode(PROJECT_STATUS,'4',PROJECT_ID))"Pipeline"
    , count (decode(PROJECT_STATUS,'5',PROJECT_ID))"Pending Review"
    from GRAPO_PROHEADTRK
    where (PROJECT_STATUS='1' or PROJECT_STATUS='2' or PROJECT_STATUS='3' or PROJECT_STATUS='4' or PROJECT_STATUS='5' or PROJECT_STATUS='6')
    group by CATEGORYNote that your "order by" clause references a field called "PROJECT_ID", which exists in the old query but you've changed other similar references to "PROJECT_STATUS" - is it possible you've just missed this one? The perils of copy-paste coding I'm afraid...

  • Need help with an array function

    I'm using the array index function and i would like to be able to control what elements go out on it.  For example, if i wanted only the first element to go out, i don't want the second element to send out zero.  Is there any way i can control what elements leave the array index function.  I also don't understand what the index inputs do on that function either.  If anyone has any advice on the application or can modify it in any way, please help.
    Attachments:
    Array and for loop.vi ‏1190 KB

    The index inputs determine what elements are retrieved. For example of you would wire a 10 and a 20 to your two index inputs, you would bet element #10 and element #20 of your array. You can resize it to get any desired number of elements.
    If you don't wire the index inputs, you'll get the first two elements.
    If you only wire the top index input (e.g a 10), you'll get element #10 and #11.
    LabVIEW Champion . Do more with less code and in less time .

  • Need Help with Advanced SQL Query

    It's advanced for me, at least. I have three tables that I
    need to use:
    Product (product_id and product_title are the fields)
    shipRegion (shipRegion_ID)
    product_shipRegion_shipCharge (product_id, shipRegion_ID,
    primaryShipCharge, secondaryShipCharge)
    What I am trying to do is create a query that will look for
    two things:
    1. Any product that is listed in the
    product_shipRegion_shipCharge table that has a primary or secondary
    ship charge of $0.00 or is NULL.
    That part is easy:
    SELECT DISTINCT p.product_id, p.product_title
    FROM product p
    INNER JOIN product_shipRegion_shipCharge pss ON p.product_id
    = pss.product_id AND (pss.primaryShipCharge IS NULL OR
    pss.primaryShipCharge = 0 OR pss.secondaryShipCharge IS NULL OR
    pss.secondaryShipCharge = 0)
    WHERE p.display = 1
    AND p.price > 0
    It's this next part that's tricky for me:
    2. Get the product_id and product_title (from the product
    table) that does NOT have any entry in the
    product_shipRegion_shipCharge table.
    I'm guessing that I need to include some kind of LEFT JOIN in
    the above query to find out what all of the regions are (from the
    shipRegion table) and then see what's missing for each product in
    the product_shipRegion_shipCharge table, but I have no idea how to
    do it.
    Anyone?
    Josh

    This should be what the query would look like using the left
    join:
    SELECT product_table.product_id, product_table.product_title
    FROM product_table
    LEFT OUTER JOIN product_shipRegion_shipCharge
    ON product_shipRegion_shipCharge.product_id =
    product_table.product_id
    WHERE product_shipRegion_shipCharge. product_id IS NULL
    SQL Server's query optimizer will probably turn the '...IN
    (subquery)' or '...exists (subquery)' into this kind of execution
    plan on its own - depending on your table structures.

  • Need help with this sql query

    the following query returns me the correct no of rows:
    select col1 from tab1 where
    col1 like '%'||chr(32)||'%';
    but i need to use my query in the following form and it doesn't return any row:
    select col1 from tab1 where
    col1 IN ('%'||chr(32)||'%');
    what am I doing worng?
    thanks in advance.

    Or in 10g (just recycling another example):
    WITH t AS (SELECT 'OPTI1457' || CHR(32) col1
                 FROM dual
                UNION
               SELECT 'OPT123' || CHR(9)
                 FROM dual
                UNION
               SELECT 'OPTIM12345'
                 FROM dual
    SELECT t.*
      FROM t
    WHERE REGEXP_LIKE(t.col1, CHR(32) || '|' || CHR(9))
    ;       C.

  • Need help with an analytic function I think

    I have a table as such:
    BID, POSITIONDATE
    1 3/10/2009
    1 3/11/2009
    1 3/12/2009
    1 3/13/2009
    1 3/13/2009
    1 3/13/2009
    1 3/14/2009
    I need to select a count(*) from this table for EACH day in MARCH, but the table is missing the days of 3/1 - 3/9
    I need my result set to be:
    BID, POSITIONDATE, COUNT(*)
    1 3/1/2009 0
    1 3/2/2009 0
    1 3/3/2009 0
    1 3/10/2009 1
    1 3/11/2009 1
    1 3/12/2009 1
    1 3/13/2009 3
    1 3/14/2009 1
    I thought LAG would do it but I cannot figure out how to get it to "make up the dates of 3/1-3/9 since those dates aren't actually in the table)
    I also tried creating a "FAKE" table (T1) with the dates of 3/1 -> 3/31 and outer joining to it, but that didn't seem to work either.
    Any tips/suggestions??
    Chris

    with t1
    as
    select to_date('03/01/2009','MM/DD/YYYY')-1 + level as Date1
    from dual
    where (to_date('03/01/2009','MM/DD/YYYY')-1+level) <= last_day(to_date('03/01/2009','MM/DD/YYYY'))
    connect by level<=31
    select * from t1
    DATE1
    3/1/2009     
    3/2/2009     
    3/3/2009     
    3/4/2009     
    3/5/2009     
    3/6/2009     
    3/7/2009     
    3/8/2009     
    3/9/2009     
    3/10/2009     
    3/11/2009     
    3/12/2009     
    3/13/2009     
    3/14/2009     
    3/15/2009     
    3/16/2009     
    3/17/2009     
    3/18/2009     
    3/19/2009     
    3/20/2009     
    3/21/2009     
    3/22/2009     
    3/23/2009     
    3/24/2009     
    3/25/2009     
    3/26/2009     
    3/27/2009     
    3/28/2009     
    3/29/2009     
    3/30/2009     
    3/31/2009     
    31 Rows Selected
    with t1
    as
    select to_date('02/01/2009','MM/DD/YYYY')-1 + level as Date1
    from dual
    where (to_date('02/01/2009','MM/DD/YYYY')-1+level) <= last_day(to_date('02/01/2009','MM/DD/YYYY'))
    connect by level<=31
    select * from t1
    DATE1
    2/1/2009     
    2/2/2009     
    2/3/2009     
    2/4/2009     
    2/5/2009     
    2/6/2009     
    2/7/2009     
    2/8/2009     
    2/9/2009     
    2/10/2009     
    2/11/2009     
    2/12/2009     
    2/13/2009     
    2/14/2009     
    2/15/2009     
    2/16/2009     
    2/17/2009     
    2/18/2009     
    2/19/2009     
    2/20/2009     
    2/21/2009     
    2/22/2009     
    2/23/2009     
    2/24/2009     
    2/25/2009     
    2/26/2009     
    2/27/2009     
    2/28/2009     
    28 Rows Selected
    I probably should change the variable to MM/YYYY and leave out day I guess, because if they put a day larger than 1, then I would end up with less than a full month.

  • I need help with an SQL Error: ORA-00904: "TBL_0022"."EUID": invalid identi

    Hello All,
    I am receiving an error message when I run a relatively simple insert statement. I have verified that all the columns are defined in the tables.
    Error starting at line 1 in command:
    INSERT INTO TBL_0022(TBL_0022.OLD_OBSID,TBL_0022.EUID,TBL_0022.MCUID,TBL_0022.WORKPERF,TBL_0022.LOC,TBL_0022.ACTION,TBL_0022.SIGN,TBL_0022.VEHID,TBL_0022.DLID,TBL_0022.SECID,TBL_0022.OBSDATE,TBL_0022.ENTDATE,TBL_0022.EID,TBL_0022.OLD0022ID,TBL_0022.OLD_ENTDATE)
    (SELECT TBL_0022_COPY.OLD_OBSID,TBL_0022_COPY.EUID,TBL_0022_COPY.MCUID,TBL_0022_COPY.WORKPERF,TBL_0022_COPY.LOC,TBL_0022_COPY.ACTION,TBL_0022_COPY.SIGN,TBL_0022_COPY.VEHID,TBL_0022_COPY.DLID,TBL_0022_COPY.SECID,TBL_0022_COPY.OBSDATE,TO_DATE(SUBSTR(TBL_0022_COPY.ENTDATE, 1, 8),'mm/dd/yyyy'),TBL_0022_COPY.EID,TBL_0022_COPY.OLD0022ID,TBL_0022_COPY.OLD_ENTDATE
    FROM TBL_0022_COPY
    WHERE length(TBL_0022_COPY.ENTDATE) = 14)
    Error at Command Line:1 Column:40
    Error report:
    SQL Error: ORA-00904: "TBL_0022"."EUID": invalid identifier

    Don't worry. Below is the formatted code for you. Run this and let me know what error it gives.
    INSERT INTO TBL_0022(TBL_0022.OLD_OBSID,
                         TBL_0022.EUID,
                         TBL_0022.MCUID,
                         TBL_0022.WORKPERF,
                         TBL_0022.LOC,
                         TBL_0022.ACTION,
                         TBL_0022.SIGN,
                         TBL_0022.VEHID,
                         TBL_0022.DLID,
                         TBL_0022.SECID,
                         TBL_0022.OBSDATE,
                         TBL_0022.ENTDATE,
                         TBL_0022.EID,
                         TBL_0022.OLD0022ID,
                         TBL_0022.OLD_ENTDATE)
    SELECT  TBL_0022_COPY.OLD_OBSID,
            TBL_0022_COPY.EUID,
            TBL_0022_COPY.MCUID,
            TBL_0022_COPY.WORKPERF,
            TBL_0022_COPY.LOC,
            TBL_0022_COPY.ACTION,
            TBL_0022_COPY.SIGN,
            TBL_0022_COPY.VEHID,
            TBL_0022_COPY.DLID,
            TBL_0022_COPY.SECID,
            TBL_0022_COPY.OBSDATE,
            TO_DATE(SUBSTR(TBL_0022_COPY.ENTDATE, 1, 8),'mm/dd/yyyy'),/* Something is wrong here with respect to 8 in substr*/
            TBL_0022_COPY.EID,
            TBL_0022_COPY.OLD0022ID,
            TBL_0022_COPY.OLD_ENTDATE
    FROM TBL_0022_COPY
    WHERE length(TBL_0022_COPY.ENTDATE) = 14Cheers
    Sarma.

  • Need help with ora-hash function

    I am doing a insert operation..in the actual view i came up with this expression ORA_HASH(c.cpt_code_grp_dscrptn
    ||c.cpt_code_grp_id) AS bwrse_link_idntfr
    i was given to insert browse_link_idntfr value as 2910441270
    how to proceed with the insertion in the actual table for those two columns?

    964145 wrote:
    I am doing a insert operation..in the actual view i came up with this expression ORA_HASH(c.cpt_code_grp_dscrptn
    ||c.cpt_code_grp_id) AS bwrse_link_idntfr
    i was given to insert browse_link_idntfr value as 2910441270
    how to proceed with the insertion in the actual table for those two columns?HUH?
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Need help with oscillating grow function in effects

    I am using the grow effect on a mouse over instead of a
    click. I used the same code that was used in the example
    distributed with the Spry 1.6 release. In the example it used an
    onmouseclick. I am using an onmouseover and onmouseout to grow and
    shrink the images.
    At first I used one function and just called the same
    function for onmouseover and onmouseout and specified the toggle
    option. The problem with this, is that the image can get "stuck"
    into the reverse state, and as you mouseover it shinks and
    onmouseout it grows.
    So I used two different functions for onmouseover and
    onmouseout. One grows and the other shrinks. This works ok if you
    use the toggle option set to true on at least one of the two
    functions. The problem is that you can still get one of the images
    stuck in the wrong size and it toggles the wrong way. If you set
    them both to false, the image oscillates between the two states as
    you mouseout. I assumed that setting toggle to false for both the
    grow and shrink would avoid images stuck in the wrong direction,
    but it is causing this strange oscillation. Am I using this option
    wrong?
    Thank you in advance for any clues you can provide....
    Here are my code snippets:
    on the Page:
    <div class="thumbnails"><div><img height="24"
    alt="your friend's icon" onmouseover="toggleThumbU(this)"
    onmouseout="toggleThumbD(this)" id="img${status.index}"
    style="padding:2px;" src="${contact.imageUrl}"
    /></div></div>
    In my Javascript code:
    var effects = [];
    function toggleThumbU(targetElement)
    if (typeof effects[targetElement.id] == 'undefined')
    effects[targetElement.id] = new
    Spry.Effect.Grow(targetElement, {duration: 200, from: '100%', to:
    '340%', toggle: false, setup:setzindex, finish:resetzindex});
    effects[targetElement.id].start();
    function toggleThumbD(targetElement)
    if (typeof effects[targetElement.id] == 'undefined')
    effects[targetElement.id] = new
    Spry.Effect.Grow(targetElement, {duration: 200, from: '340%', to:
    '100%', toggle: false, setup:setzindex, finish:resetzindex});
    effects[targetElement.id].start();

    I have the same issue, anyone know a way around this? I have
    a image i wish to grow onmouse over, then using the same behavior
    but shrink with mouseout, it gets some wierd issues, like if you
    put the mouse in between it oscillates back and forth, its not
    smooth.

Maybe you are looking for

  • FND_NO_REGION_DATA error while deploying a custom page to server.

    Hi all, I have a custom page which is running fine on my jdev. When I transfer it to server it gives me the error - oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND_NO_REGION_DATA. Tokens: REGIONCODE = /oracle/apps/aear/dunn

  • In search of a new hard drive, any suggestions?

    Hello All, It seems I didn't end up with good success from my new Seagate Momentus 7200.4 500GB Model ST9500420AS. As it began clicking this evening. So I reinstalled my original 320GB Hitachi drive and did a clean install of the osx as well. I would

  • Same material number Ciffing from different ECC system

    Hello Gurus,        I have APO system connected with two ECC system. If there is a material with the same name in both the system how does the APO system finds the respective system. Even if I assign BSG for the logical systems, to which system will

  • How to import/export in Pl/SQL ?

    Hello I want to write a procedure in PL/SQL which will be copying one user's schema to another. I have Oracle 9i on Windows 2000. My first idea was to use IMP EXP commands, but i need to execute this commands from PL/SQL procedure. How can I do this,

  • Postfic qmgr running and relaying, but shouldn't be!

    Hi, We are running a separate web server and mail server (both 10.4.8). Mail services are turned OFF on the web server, but the web server keeps trying to relay a message to the mail server. Here is an excerpt from the mail.log on the web server: Dec