Zend Framework gives strange Oracle query

I'm trying to migrate an application from MySQL to Oracle. I'm a newbie to Oracle.
I want the PHP scripts to work on both MySQL and Oracle.
The query I want to do used to be (for MySQL via AdoDB):
SELECT DISTINCT (id)
FROM table1
INNER JOIN table2 ON table1.id = table2.record_id
AND table2.user_id = "XXX"
AND table1.status = table2.status_id
The following code works great for MySQL but generates some strange output for Oracle:
$db = Zend_Db::factory('Oracle', //Mysqli for the MySQL db connection
array(
'host' => 'hostName',
'dbname' => 'dbName',
'username'=> 'userName',
'password'=> 'userPasswd')
$select = $db->select();
$select->distinct();
$select->from(array('i' => 'table1'),array('id'));
$select->joinInner(array('u' => 'table2'),'i.id = u.record_id',array());
$select->where('u.user_id = ?', 'XXX');
$select->where('i.status=u.status_id');
This results in
for MySQL:
SELECT DISTINCT `i`.`id` FROM `table1` AS `i` INNER JOIN `table2` AS `u` ON i.id = u.record_id WHERE (u.user_id = 'XXX') AND (i.status=u.status_id)
this works fine.
for Oracle:
SELECT DISTINCT "i"."id" FROM "table1" "i" INNER JOIN *"table2" "u" ON i.id = u.record_id WHERE (u.user_id = 'XXX') AND (i.status=u.status_id)
this does not work:
ORA-00942: table or view does not exist
when I copy/paste this in SQL developer this gives an error too, complaining about ' *"table2" ' which does not exist.
The only query my SQL developer accepts is :
SELECT DISTINCT i."id" FROM table1 i INNER JOIN table2 u ON i."id" = u."record_id" WHERE (u."user_id" = 'XXX') AND (i."status"=u."status_id")
I have no idea how I can make this query with Zend Framework.
The query should have:
- no quotes around the table names
- quotes around the column names
- no * before the second table name (table2)
Is this a Zend Framework problem or is my Oracle db not very well made?

I believe there are some issues with ZF regarding quoting, e.g. see http://framework.zend.com/issues/browse/ZF-7267 (also note the comment about autoQuoteIdentifier).
I'd review open ZF bugs, upgrade to the latest ZF and report the issue if it still occurs.
At worst case, you may need a branch in your code that manually constructs the query when running against Oracle.

Similar Messages

  • Oracle + PDO + Zend Framework

    Hello everyone,
    I am trying to connect to an Oracle database thru php PDO using the Zend_Db from Zend Framework, but i have a connection error stating that i use incorect handle
    the server platform is Linux
    The database software is 10G2 (enterprise edition)
    PHP version is 5.2.5
    oracle SID is web02prd
    PHP code for connect :
    public static function setDb(){
              $options = array ( Zend_Db::CASE_FOLDING => Zend_Db::CASE_UPPER);
              $params = array ('username' => 'user',
                             'password' => 'pass',
                             'dbname' => 'web02prd',
                             'options' => $options);
              try{
                   $db = Zend_Db::factory("PDO_OCI",$params);
                   $db->getConnection();
                   return $db;
              }catch(Zend_Db_Adapter_Exception $e){
                   echo $e->getMessage();
                   Zend_Debug::dump($db);
    and the error is :
    SQLSTATE[]: pdo_oci_handle_factory: OCI_INVALID_HANDLE (/usr/src/PDO_OCI/oci_driver.c:463)
    pdo and PDO_OCI are listed when i type php -m in command line

    hi, i've look at the article but it don't explain about PDO but using MVC and the Oracle Adapter, from my own research, the problem i have comes from Oracle installation or the PDO_OCI package, because when i try from 2 different workstation with different OS and having their own apache and php ENV it will work, it won't work on the oracle database host :/

  • Query on using Variables in Oracle Query

    Hi
    i am new to Oracle, i have tried extracting data from the Oracle Database using the following Query which includes 1 variable SYSDATE_UTS, however when i try to execute the Query i get an error. Please let me know what am i doing wrong and how can i correct it.
    Error Message
    ORA-06550: line 4, column 1:
    PLS-00428: an INTO clause is expected in this SELECT statement
    Oracle Query
    DECLARE SYSDATE_UTS NUMBER := (sysdate-to_date('19700101','yyyymmdd'))*86400;
    BEGIN
    SELECT
    INCIDENT_NUMBER,
    to_date(to_char((1/86400*REPORTED_DATE)+to_date('19700101','yyyymmdd'),'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as REPORTED_DATE_TIME,
    ,GROUP_TRANSFERS
    ,LAST_MODIFIED_BY
    ,to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * LAST_MODIFIED_DATE,'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as LAST_MODIFIED_DATE
    ,(to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) as AGE
    ,CASE
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 0 AND 1 THEN '0-1 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS, 'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 2 AND 4 THEN '2-4 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 5 AND 9 THEN '5-9 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 10 AND 19 THEN '10-19 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) >20 THEN '20+ Days'
    ELSE 'UNKNOWN'
    END AS AGE_GROUP
    FROM IncidentDataBase
    and STATUS not in (4,5,6)
    and rownum <10;
    END;

    Hi Frank
    i am using the following Oracle Version
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for Linux: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    and Quest Toad for Oracle to write and execute the queries:
    Toad for Oracle Xpert
    Version 10.1.1.8
    The code i am using is:
    variable SYSDATE_UTS NUMBER;
    exec SYSDATE_UTS := (sysdate-to_date('19700101','yyyymmdd'))*86400;
    SELECT
    INCIDENT_NUMBER,
    to_date(to_char((1/86400*REPORTED_DATE)+to_date('19700101','yyyymmdd'),'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as REPORTED_DATE_TIME
    ,GROUP_TRANSFERS
    ,LAST_MODIFIED_BY
    ,to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * LAST_MODIFIED_DATE,'mm/dd/yyyy hh24:mi:ss'),'mm/dd/yyyy hh24:mi:ss') as LAST_MODIFIED_DATE
    ,(to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) as AGE
    ,CASE
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 0 AND 1 THEN '0-1 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS, 'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 2 AND 4 THEN '2-4 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 5 AND 9 THEN '5-9 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) BETWEEN 10 AND 19 THEN '10-19 Days'
    WHEN (to_date(to_char(to_date('01011970','ddmmyyyy')+1/24/60/60 * :SYSDATE_UTS,'mm/dd/yyyy'),'mm/dd/yyyy')) - (to_date(to_char(+to_date('19700101','yyyymmdd')+1/86400*REPORTED_DATE,'mm/dd/yyyy'),'mm/dd/yyyy')) >20 THEN '20+ Days'
    ELSE 'UNKNOWN'
    END AS AGE_GROUP
    FROM IncidentDataBase
    WHERE STATUS not in (4,5,6)
    and rownum <10;
    Notes:
    1. When i put the cursor before "variable" (starting of the query) and execute the script i get an Error: ORA-00900: invalid SQL statement.
    2. When i put the cursor just before "SELECT" i get a pop up.
    a. it is a Toad window which displays the available variables (in this case :SYSDATE_UTS).
    b. gives me a dropdown option to select the type (by default VARCHAR2 is selected).
    c. there is a value field where i need to enter the value for the Variable.
    d. the SQL statement shown in this dilog box does not include the 1st 2 lines
    variable SYSDATE_UTS NUMBER;
    exec SYSDATE_UTS := (sysdate-to_date('19700101','yyyymmdd'))*86400;
    Q: is there something wrong in the syntax i am using?
    Sven W. - I have been using your method all these days, which works just fine. i wanted to know how i could use a variable instead.
    Business Requirement - My whole intent is to calculate the Age of an incident (Difference between "Reported Date" and current date) and to assign Age Groups (0-1 Days, 2-4 Days,....,20+ Days).
    Edited by: 921713 on Mar 19, 2012 12:23 PM

  • Converting MS SQL Server Query to Oracle Query

    Hi There,
    I've a strange problem. My project uses both MS SQL Server and Oracle server at run time. I've lot of queries which are written in MS SQL Style. Now, iam planning to write a helper class whic converts MS SQL Query to Oracle Query. Please Help me if any one has that kind of Helper with you.
    Thanks And Regards,
    Sasi Kanth

    That is why persistence applications like Hibernate or
    CMP get used for apps that will use more than one DB,
    but it takes upfront planning.
    If you have a set of automated unit tests that work
    with SQL Server, they will be a big help in getting
    your Oracle code up and running.Indeed - JUnit and Ant would be a big help here.
    It sounds like you have SQL in your JSPs, that will
    work against you as well if so. If you are using a
    DAO pattern, this will be much easier, as you can
    re-implement each DAO for Oracle.If you'd layered this app properly, you might just implement an OracleDAOFactory and be done with it. Interfaces and a DAO layer would go a long way.
    This is why layering is such a good idea. It isolates changes in a smaller subset of classes.
    But your problem sounds pretty big. It'd be daunting even if it were well designed.

  • Configuration of redirects from Zend Framework

    Hi,
    I have to use a PHP project which are develop based on Zend Framework. I use SJWS 7u4 and have to implement mod_rewrite rules form Zend Framework (stndard rules).
    I have to make rewrite url from http://some-name/some-dir/some-dir2 into http://some-name/index.php/some-dir/some-dir2
    Exactly mod_rewrite rules are:
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ index.php [NC,L]
    RewriteBase /
    I tried to make some rules in obj.conf, but I have problem with Sun's rules (my rules make strange chain of redirects).
    IS there anybody to help? Maybe soemone heve the same problem.
    Irek

    Unless I'm reading your rules wrong they seem to be saying:
    If the requested URI exists and has size, OR
    If the requested URI is a sym link, OR
    If the requested URI is a directory, THEN
    Serve the file as requested, OTHERWISE
    Rewrite the URL (internally restart the request) as index.php
    Do I have that right?
    I'd probably do something like this:
    <If not $internal
        and not -s $path > 0
        or not -l $path
        or not -d $path>
      AuthTrans fn="restart" uri="/index.php"
    </if>This may be more complex than what you need though (it also might now actually work the way I think it does, I haven't tried it). What you appear to be doing is saying "if the URI points to a real resource, serve it otherwise process the request as though it was for index.php." This could probably be accomplished more easily with:
    <If not $internal
        and not -U $path>
      AuthTrans fn="restart" uri="/index.php"
    </if>This tells Web Server to skip the evaluation if the request has already been restarted AND if $path points to a real (and accessible) file on disk.
    I just yesterday [wrote about a similar evaluation|http://jmccabe.org/drupal_and_web_server] in making Drupal work with Web Server. A couple of my other blog entries cover using the expression syntax for various tasks.
    I also recommend bookmarking and re-reading often the [expression docs|http://docs.sun.com/app/docs/doc/819-2630/gdaer?a=view] . I find myself re-reading it constantly when playing with expressions.

  • Add MySQL + Zend Framework 2?

    My LAN: Mac Mini Server + Time Capsule + two iMacs. Comcast cable modem is in bridged mode, DHCP and NAT provided by Time Capsule. Mac Mini Server provides DNS service to the LAN and Open Directory service as well as FTP, Websites and Wiki services that are publicly accessible to authorized users.
    One of the iMacs was previously configured to run Apache Server, MySQL and PHP as well as phpMyAdmin and Zend Framework 2. All were disabled so they would interfere with setting up a LAN and incorporating Server.app. I want to start developing with ZF2 again.
    Is it better to add MySQL + phpMyAdmin + ZF2 to the Server or make the modifications necessary to have them continue to run on the iMac?
    I prefer to stay with MySQL but don't mind giving MariaDB a try.
    I don't mind buying another domain name if that makes things easier, but it will have to share my current static IP address. It's main use will be for developing and testing PHP/ZF2 applications.
    Thanks in advance for any recommendations!

    Thank you for your comments, they're appreciated, especially the advice regarding phpMyAdmin. I like to use it for development, but it's not necessary in a production environment.
    There is a LOT of information about MySQL, PostgreSQL, MariaDB, phpMyAdmin, PgAdmin, phpPgAdmin, ZF2, etc. for Mountain Lion that erroneously claim to work for Mountain Lion Server as well. But there are significant differences between ML and ML Server, at least with PostgreSQL (different location) and PgAdmin (removed by the Server.app installer).
    I may give PostgreSQL and PgAdmin or phpPgAdmin a try since PostgreSQL is already installed. PgAdmin and phpPgAdmin were very easy to install and configure.
    PostgreSQL is used by some services provided by Server.app so I need to be careful when setting it up for my databases. It may be as simple as creating another superuser.
    Then again, it may be better to reconfigure the setup on iMac to get it working in my network. Based on your recommendation in another thread I looked into MariaDB as a "drop-in" replacement to MySQL. That looks promising, but I'm wary of using MacPorts or Homebrew to install it and I haven't yet slogged through all the steps needed to compile it on my iMac.

  • Using Zend Framework

    Is anyone using zend with Wamp successfully, I have revisited this "framework" a few times but revert back to amfphp because at least it works, now when I go to start with zend it copies itself to my host then when I go to create classes I get an error if I try to proceed wamp gets trashed.
    image of error attached.
    David

    Mayank (Adobe) wrote:
    Did the server settings entered in the new project wizard validate? Which version of WAMP are you trying to use?
    -mayank
    The server was validated and zend installed into the wamp webfolder correctly, its just that when attempting to create a sample class things fail then wamp becomes unusable even after a reboot. I use wamp 2.0i.  Anyway the upshot is that from the beginning the zend framework has been more a hinderance than a help its a pity that Adobe didn't strike a deal with the author of AMFPhp(who unfortunately went to zend) and just give us a proper set of AMF classes instead of a low performance framework which is more about bloat than functionality and even less about AMF.
    Anyway as I said earlier i have better things to do with my time and I now have the deprecated parts of AMFPhp sorted so its back to something that works without the headaches.
    David.

  • Some diffrence in oracle query and mysql query

    sir i see both query in SessionBean1
    mysql query
    SELECT ALL usert.username,
    usert.userid,
    usert.camid FROM usert
    this not use user name
    oracle query
    SELECT ALL MFA.LUSER.USERID,
    MFA.LUSER.TITLE,
    MFA.LUSER.CAMPID,
    MFA.LUSER.PWD,
    MFA.LUSER.USERNAME
    FROM MFA.LUSER
    the user name mfa is use in this query you can see
    this is main diffrence
    but i yse both in code but not get result
    try {
    RowKey userRowKey = luserDataProvider.findFirst
    (new String[] { "MFA.LUSER.USERNAME" },
    new Object[] { textField4.getText()});
    if (userRowKey == null) {
    textField3.setText("11111");
    return null;
    } else {
    textField3.setText("22222");
    return null;
    catch (Exception e) {
    log("Cannot perform login for userid " + textField3.getText(), e);
    error("Cannot perform login for userid " + textField3.getText() + ": " + e);
    textField3.setText("77777");
    return null;
    problem in only oracle not in mysql
    please give me idea how i get result
    thank you

    can you post your query with explain plan for both 9i version and 10g version.
    Thanks,
    karthick.

  • Oracle query help

    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    Report Builder 10.1.2.0.2
    ORACLE Server Release 10.1.0.4.2
    Oracle Procedure Builder 10.1.2.0.2
    Oracle ORACLE PL/SQL V10.1.0.4.2 - Production
    Oracle CORE    10.1.0.4.0    Production
    Oracle Tools Integration Services 10.1.2.0.2
    Oracle Tools Common Area 10.1.2.0.2
    Oracle Toolkit 2 for Windows 32-bit platforms 10.1.2.0.2
    Resource Object Store 10.1.2.0.2
    Oracle Help 10.1.2.0.2
    Oracle Sqlmgr 10.1.2.0.2
    Oracle Query Builder 10.1.2.0.2 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle ZRC 10.1.2.0.2
    Oracle XML Developers Kit 10.1.0.4.2 - Production
    Oracle Virtual Graphics System 10.1.2.0.2
    Oracle Image 10.1.2.0.2
    Oracle Multimedia Widget 10.1.2.0.2
    Oracle Tools GUI Utilities 10.1.2.0.2
    I have enclosed sample data and also table structure. I need help in getting the query.
    select dept_id,proc_code,override_goal,goal_override_date
      from table2
    where goal_override_date between '02-jan-2014' and '11-jan-2014'
       and dept_id = 10
       and proc_code = 'CP'
    select DEPT_ID, PROC_CODE, DAY_SUNDAY, DAY_MONDAY,
           DAY_TUESDAY, DAY_WEDNESDAY, DAY_THURSDAY,
             DAY_FRIDAY, DAY_SATURDAY
      from table1
    where dept_id =10
    and proc_code = 'CP'; 
    Table1  is kind of maintenance table.
    In Table2 values can be overridden.
    Requirement
    Check to see if there is data in table 2 for the date range . If table2 has no value then take value from table1 for that day the date falls into. Any more clarification please ask me.
    Sundays are all zeros.
    I want this data. and the sum for the date range.
    2-jan-2014  - 3
    3-jan-2014  - 3
    4-jan-2014  - 3
    5-jan-2014  - 0
    6-jan-2014  - 1
    7-jan-2014  - 3
    8-jan-2014  - 5
    9-jan-2014  - 5
    10-jan-2014 - 3
    11-jan-2014 - 3
    Sum for the date range has to be 29
    Sample table and data
    CREATE TABLE TABLE1
      DEPT_ID NUMBER NOT NULL,
      PROC_CODE VARCHAR2(2 BYTE) NOT NULL,
      DAY_SUNDAY NUMBER(4) NOT NULL,
      DAY_MONDAY NUMBER(4) NOT NULL,
      DAY_TUESDAY NUMBER(4) NOT NULL,
      DAY_WEDNESDAY NUMBER(4) NOT NULL,
      DAY_THURSDAY NUMBER(4) NOT NULL,
      DAY_FRIDAY NUMBER(4) NOT NULL,
      DAY_SATURDAY NUMBER(4) NOT NULL
    Insert into TABLE1
      (DEPT_ID, PROC_CODE, DAY_SUNDAY, DAY_MONDAY, DAY_TUESDAY,
      DAY_WEDNESDAY, DAY_THURSDAY, DAY_FRIDAY, DAY_SATURDAY)
    Values
      (10, 'CP', 0, 3, 3,
      3, 3, 3, 3);
    COMMIT;
    CREATE TABLE TABLE2
      DEPT_ID NUMBER NOT NULL,
      PROC_CODE VARCHAR2(2 BYTE) NOT NULL,
      OVERRIDE_GOAL NUMBER(4),
      GOAL_OVERRIDE_DATE DATE NOT NULL
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 1, TO_DATE('01/06/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 3, TO_DATE('01/07/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 5, TO_DATE('01/08/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 5, TO_DATE('01/09/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 3, TO_DATE('01/10/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    Insert into TABLE2
      (DEPT_ID, PROC_CODE, OVERRIDE_GOAL, GOAL_OVERRIDE_DATE)
    Values
      (10, 'CP', 3, TO_DATE('01/11/2014 00:00:00', 'MM/DD/YYYY HH24:MI:SS'));
    COMMIT;
    Help is highly appreciated.

    SELECT dates,
           override_goal,
           SUM(override_goal) OVER()
           FROM(SELECT dates,
                       CASE WHEN EXISTS(SELECT 1
                                        FROM table2 t2
                                        WHERE t2.goal_override_date = qry1.dates
                                        AND t2.dept_id = 10
                                        AND t2.proc_code = 'CP')
                            THEN (SELECT override_goal
                                  FROM table2 t2
                                  WHERE t2.goal_override_date = qry1.dates
                                  AND t2.dept_id = 10
                                  AND t2.proc_code = 'CP')
                       ELSE (SELECT DECODE(days,'SUN',day_sunday,
                                                'MON',day_monday,
                                                'TUE',day_tuesday,
                                                'WED',day_wednesday,
                                                'THU',day_thursday,
                                                'FRI',day_friday,
                                                'SAT',day_saturday )
                              FROM table1)
                       END as override_goal
                FROM (SELECT in_dt1+(LEVEL-1) dates,
                             TO_CHAR(in_dt1+(LEVEL-1),'DY') days
                      FROM(SELECT TO_DATE(&from_date,'DD-MON-YYYY') in_dt1,
                                  TO_DATE(&to_date,'DD-MON-YYYY') in_dt2
                                 FROM dual)
                      CONNECT BY LEVEL <= (in_dt2 - in_dt1)+1) qry1);
    Now run the query it will prompt you for the inputs. You can pass the date values and check the result. Otherwise replace &from_date,&to_date with user inputs

  • How to enforce index in oracle query

    Hi all
    how to enforce index in oracle query
    Regards

    Use INDEX hint to force Optimizer to use the specfied index.
    You really need to investigate why Optimizer doesn't choose the index. Remember, INDEX SCAN are not always GOOD.
    Jaffar

  • Updating Zend Framework

    How can I update Zend Framework in Flash Builder 4? Flash Builder currently installs version 1.10.1 of the Framework, and I want to install version 1.10.7
    I need to install the newest version of Zend Framework because I have a problem with Network Monitor, non-English characters are displaying as ????.
    Regards,
    Haydex Kadhim,
    Researcher - Iraq.

    Ooops!! really I'm sorry. I will post it in Flash Builder Forum and remove this one...But you know I have really asked my self before posting it, if it fits flex or Flash Builder but I guess my choice was wrong for flex.
    I have another post for Mate Framework should I delete that post too?
    Regards,
    Haydex Kadhim,
    Researcher - Iraq.

  • Passing parameters to oracle query

    Hi Everyone,
    I'm a newbie to oracle and need help passing parameters to an oracle query. For example, I need to show all the employees in a certain department.So a list of "DEPT_CODE"'s will be displayed on a webpage and then the selected value will be passed to the query. I currently have this query in MS Access and use the bracket for user input ("[Dept]"). But how can this be done in oracle?
    I am using ASP.NET 2.0 and Crystal Reports XI. Basically I have a webform where users can select the date range and department from a listbox. When the submit button is clicked, the values are passed to the query in crystal reports. For example, I have a query with "DEPT" as a parameter. So I pass the value of the selected listbox item from the webform to the crystal report. But now I have to select data from an oracle database and provide parameters. This is where I need help.
    Thanks in advance
    -Sam

    Duplicate post.
    Refer to this thread
    Passing parameters to oracle query

  • Oracle  query from awr report

    Hi,
    I need to run an Oracle query with the following fields in the AWR report:
    First Query:
    DB Name
    Begin Snap Time
    End Snap Time
    Begin Snap
    End Snap
    Event
    Waits
    Time(s)
    Avg wait (ms)
    % DB time
    Wait Class
    Second Query:
    DB Name
    Begin Snap Time
    End Snap Time
    Begin Snap
    End Snap
    Elapsed Time (s)
    Executions
    Elapsed Time per Exec(s)
    %Total
    %CPU
    %IO
    SQL Id
    SQL Module
    SQL Text
    How Can I write this query?
    Thanks in advance!

    R.Royal wrote:
    Thanks,
    I know how to generate an AWR report but I would like to write a query that takes these fields from oracle views. (DBA_ or V$)
    And the link I sent to you shows you the views required to do that.
    Cheers,

  • Oracle query hints in JPQL - is it possible?

    Sorry, posted to wrong forum... I don't know how to delete it - only edit...
    Hello,
    I am using Sun Java Application Server 9.1 (GlassFish), EJB 3.0 and JPA (TopLink). My database is Oracle.
    Is there any way to specify Oracle query hints (for example, /*+ rule */ in JPQL queries? Or the only way to do it is using native queries?
    Many thanks in advance
    Edited by: Troff_2 on Nov 27, 2007 5:50 AM

    Yes.It is possible.Only need to modify the view for order tracker query need to change.
    You can use decode statement in the query to add status as Processing .
    Please refer the IBE_ORDER_SUM_V view for details.
    Eg:
    decode(oel.meaning,'Booked',"Processing",oel.meaning) from
    oe_lookups        
    oel,

  • Problems installing Zend Framework on Windows

    Hi,
    I've set up a Flex project that uses the Zend Framework to communicate with a PHP webservice, and on my development machine, which is a Mac, it works fine. The framework was installed automatically by Flash Builder, and I've then added my services to that.
    However when I go to upload this to the Windows server which will be hosting the live solution, I get an error message as follows:
    (mx.messaging.messages::ErrorMessage)
    faultCode = "Client.Error.DeliveryInDoubt"
    faultDetail = "Channel disconnected before an acknowledgement was received"
    I have updated the amf_conf.ini to point to the correct location for the services folder and the framework itself, and if I try to call a method which doesn't exist on the service then I get the following error:
    faultDetail = "#0 C:\xampp\htdocs\PHPFrameworks\ZendFramework\library\Zend\Amf\Server.php(553): Zend_Amf_Server->_dispatch('test', Array, 'WebService')
    #1 C:\xampp\htdocs\PHPFrameworks\ZendFramework\library\Zend\Amf\Server.php(629): Zend_Amf_Server->_handle(Object(Zend_Amf_Request_Http))
    #2 C:\xampp\htdocs\gateway.php(69): Zend_Amf_Server->handle()
    #3 {main}"
      faultString = "Method "test" does not exist"
    This suggests to me that the framework is running properly and is able to introspect the class, because it tells me that the method doesn't exist.
    So I'm puzzled as to why this isn't working. It isn't an issue with connecting to the database as the 'test' method only returns a string - there is no logic besides a simple return.
    I've tried including the Zend Framework path in the php.ini config, but I won't be able to do this on the live (hosted) server, but even so it didn't help.
    Does anyone have any idea what could be causing this?
    Many thanks,
    Christian

    FOUNDED A SOLUTION!!!!!!
    I was in the same situation, and after searching everywhere, tried evreything except reinstall the whole OS and all the programs from beginning (this I was told by the adobe help center!!), I tried the impossibile (or maybe not):
    1 - uninstalled muse (it was in the list of uninstallable softwares, even if muse was not really installed, no directory, no shortcut, nothing)
    2 - uninstalled air
    3 - downloaded muse from here http://www.adobe.com/go/muse_latest-win and installed
    UNBELIVABLE the installation begin (before when clicking on it nothing happened)
    4 - launched the program and incredibly it ran!!!!
    5 - downloaded (from here http://get.adobe.com/air) and reinstalled air and the program said that it was still installed!!!
    6 - I tried to launch an air application (adobe help for example) and it worked!!!!!!!
    Hope this is a possible solution for someone else, I really lost days fixing that
    ps: just an updated still persistent little bug: I'm a creative cloude subscriber, and in my CC panel I still have the option of install muse

Maybe you are looking for

  • HP Laserjet Pro P1102W not printing even though it's installed...

    Hello everyone. I'm relatively new to Arch, especially new with configuring cups. I just bought an HP LaserJet Pro p1102w wireless printer. I set it up on my dads laptop via plugging it into the usb and it automatically ran the setup program and I se

  • In the USOBT table Field 'Low' is fetching wrong data

    Hi All,              I am generating a report for the basis, in that am fetching data from USOBT table there is a field 'Low' . Its not fetchng correct data for the field values like WERKS, VTWEG etc. actaully the values r populating like $WERKS,$VKO

  • Thumbnails disappear

    why  do the thumbnails disappear in iphoto for the iphone 4 when you put the privacy mode on sometimes is it a glitch or its a way to do it

  • Need the Nomad Jukebox Expert He

    I Have just put a new hard dri've in my zen xtra,got the songs put on,everything was fine,but now my pc wont recognize my player,and when i play a song it has no info on the screen but the music plays anyways.any help would be appericiated.thanks in

  • I have a copy of Adobe Photoshop 7 and once worked with Win 7

    but now that I want to reinstall on my Windows 8.1 fairly new computer it won't even install how do I get it to install without paying hundreds of dollars again. I downloaded and intalled the 7 upgrade bvut it did nothing. I'm assuming it did nothing