Please help -- MySQL Query to Oracle

I have been trying to convert the following MySQL query to work with Oracle 9i. There seem to be two problems:
1) Oracle doesn't like the inclusion of the tblpackagegeneral.packageid in the "ON" clause of the "JOIN".
2) The "GROUP BY" only has the one field, "tblpackagegeneral.packageid", specified; Oracle wants the other two specified as well. When I do that I get a different data set than what MySQL returns for the same tables of data: specifically MySQL returns one row for each packageid but the revised Oracle version returns more than 1 sometimes.
I would appreciate any assistance possible.
/* Formatted on 2003/07/07 14:43 (Formatter Plus v4.8.0) */
SELECT tblpackagegeneral.packageid,
CASE
WHEN NVL
(COUNT (tblpackagelearnerassignment.learnerid),
COUNT (tbllearnergeneral.learnerid)
) > 0
THEN 'Activity'
WHEN tbllearnergeneral.subscribetopubliccourse = 'true'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'ActivityAfterSubscribe'
WHEN ( tbllearnergeneral.subscribetopubliccourse = 'false'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'Subscribe'
ELSE 'Subscribe'
END AS "ASSIGNSTATUS"
FROM tblpackagegeneral, tbllearnergeneral LEFT OUTER JOIN tblpackagelearnerassignment ON ( tblpackagelearnerassignment.packageid =
tblpackagegeneral.packageid
AND tblpackagelearnerassignment.learnerid =
tbllearnergeneral.learnerid
WHERE tbllearnergeneral.learnerid = '%var'
AND tblpackagegeneral.packageavailability = 'Available'
AND TO_CHAR (tblpackagegeneral.dateto, 'YYYYMMDD') >=
TO_CHAR (CURRENT_TIMESTAMP, 'YYYYMMDD')
GROUP BY tblpackagegeneral.packageid;
Sincerely,
Bill Robinson

I have been trying to convert the following MySQL query to work with Oracle 9i. There seem to be two problems:
1) Oracle doesn't like the inclusion of the tblpackagegeneral.packageid in the "ON" clause of the "JOIN".
2) The "GROUP BY" only has the one field, "tblpackagegeneral.packageid", specified; Oracle wants the other two specified as well. When I do that I get a different data set than what MySQL returns for the same tables of data: specifically MySQL returns one row for each packageid but the revised Oracle version returns more than 1 sometimes.
I would appreciate any assistance possible.
/* Formatted on 2003/07/07 14:43 (Formatter Plus v4.8.0) */
SELECT tblpackagegeneral.packageid,
CASE
WHEN NVL
(COUNT (tblpackagelearnerassignment.learnerid),
COUNT (tbllearnergeneral.learnerid)
) > 0
THEN 'Activity'
WHEN tbllearnergeneral.subscribetopubliccourse = 'true'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'ActivityAfterSubscribe'
WHEN ( tbllearnergeneral.subscribetopubliccourse = 'false'
AND tblpackagegeneral.packageaccess = 'Public'
THEN 'Subscribe'
ELSE 'Subscribe'
END AS "ASSIGNSTATUS"
FROM tblpackagegeneral, tbllearnergeneral LEFT OUTER JOIN tblpackagelearnerassignment ON ( tblpackagelearnerassignment.packageid =
tblpackagegeneral.packageid
AND tblpackagelearnerassignment.learnerid =
tbllearnergeneral.learnerid
WHERE tbllearnergeneral.learnerid = '%var'
AND tblpackagegeneral.packageavailability = 'Available'
AND TO_CHAR (tblpackagegeneral.dateto, 'YYYYMMDD') >=
TO_CHAR (CURRENT_TIMESTAMP, 'YYYYMMDD')
GROUP BY tblpackagegeneral.packageid;
Sincerely,
Bill Robinson

Similar Messages

  • Please help me to get Oracle 10.2.0.5 software for 64 bit Windows 2008 R2

    Hi All,
    Subject: Please help me to get Oracle 10.2.0.5 software for 64 bit Windows 2008 R2 operating system.
    I am looking for Oracle 10.2.0.5 software to install in windows 2008 server (64 bit) R2. I tried with oracle download repository but unfortunately I couldnt find this software. In the below link I can see the product Oracle 10.2.0.5 - 64 bit (Itanium). I have tried to download and install in the server but I received in-compatible error message.
    http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
    From the oracle support certification site I have found that the Oracle 10.2.0.5 is the compatible version to installed in windows 2008 server(64) R2.
    I am trying very hard to find Oracle 10.2.0.5 - 64 bit. Can you please suggest me where I can download this software.
    Please do the needful.
    Regards,
    Jame

    Hi;
    Which means, do i need to install 10.2.0.4 and then to upgrade 10.2.0.5 using patchset?10.2.0.1 is base relase 10.2.0.x is patchest. 10.2.0.5 cover previous patchest errors which mean you do not need install 10.2.0.4 than upgrade it 10.2.0.5
    Regard
    Helios

  • Conversion of Mysql query in oracle acceptable query format

    Hi
    I have successfully converted my MySql database in oracle. Now the problem is how to execute already written hundreds of Mysql query on the oracle. There are many syntax variation in Mysql query format which is not acceptable for oracle.
    For Example
    Select case_id as 'this is alias' from cases
    The above query can run on Mysql database but have problem while executing Oracle, because single quotes should be replaced with double quotes before executing it on oracle. There are also many other syntax conflicts.
    I have tried to resolve the problem through SwisSQLAPI but problem still exist as SwisSQLAPI is not dealing with all syntax conflict. In my case (select if (expresion, true,false)) must be replace with decode (expression, value,true,false) function of oracle and this conversion is not supported by SwisSQLAPI.
    Please help me in resolving this problem
    Thanks

    The problem with trying to port from one language (mysql SQL) to another (oracle SQL) is that there's generally no hard rules for a computer to follow, that it will get it 100% correct.
    Look at babelfish when you translate a foreign language to English. The end result is readable (usually), but it's rarely completely correct.
    The problem is when you feed something into Oracle SQL, it needs to be 100% correct.
    All you can really do here is rewrite these queries. It shouldn't actually take as long as you think, because 50% of queries will generally need very minor changes you can do in a minute, and 25% won't need any changes at all.

  • Very urgent!!! Please help! Anybody from Oracle who can help?

    I am using Oracle9i with oracle pool in my JSP for database handling.
    I am using OracleConnectionCacheImpl and OracleConnectionCacheImpl.DYNAMIC_SCHEME.
    I am also setting max and min limit for connections
    ocacheimpl.setMinLimit (5);
    ocacheimpl.setMaxLimit (10);
    I have used a startup servlet that loads on tomcat startup
    creating pool ( that is, OracleConnectionCacheImpl)
    This OracleConnectionCacheImpl in then I am putting as
    application wide object and getting access to it in all my JSPs
    Initially it creates 5 connections. But after some time (2 hrs or
    so) all the connections are getting killed. (I can see this
    from the "Sessions" tab of the enterprise manager)
    Now if I request my JSP then I get error. But after around 30mins
    again 5 connections are created automatically( I hope thats what
    DYNAMIC_SCHEME would do) and then my JSp works.
    My question is why all connections are getting killed and why it
    takes so much time to reset the connections again!
    Is Oracle's DYNAMIC_SCHEME has got some bug? or I have to do
    some settings in my oracle server. Please help
    I am using oracle9i in Japanese OS(Windows).

    Check once *REMADV *.
    Amit.

  • Please help in query performance

    select bg.billing_group_id,r.rating_result, count(*),rc.source,rc.description
    from rejected_record r,
    result_code@RD rc,
    terminal_device@cust td,
    personal_account_td@cust patd,
    personal_account@cust pa,
    billing_group@cust bg,
    -- tariff_plan@rd tp,
    (select pcs.primary_session_id, pcs.charging_date
    from pcs@umr_interface
    where pcs.range_cdr_file_source not like 'HOT%'
    --and lower(pcs.RANGE_CDR_FILE_SOURCE) not like 'rec%'
    -- and lower(pcs.RANGE_CDR_FILE_SOURCE) not like 'sms%'
    -- and lower(pcs.RANGE_CDR_FILE_SOURCE) not like 'data%'
    -- and pcs.CHARGING_TYPE_ID = 1
    and pcs.charging_date between '20/Aug/2010' and '21/Sep/2010') t
    where r.primary_session_id = t.primary_session_id
    and rc.code (+)= r.rating_result
    and td.terminal_device_id = patd.terminal_device_id
    and patd.personal_account_id = pa.personal_account_id
    and r.calling_party_number_rid = td.msisdn
    and pa.billing_group_id = bg.billing_group_id
    and r.is_precharged=0
    --and td.tariff_plan_id=tp.tariff_plan_id
    and (nvl(td.date_to,'01.01.2000')='01.01.2000')
    and (nvl(pa.date_to,'01.01.2000')='01.01.2000')
    and (nvl(patd.date_to,'01.01.2000')='01.01.2000')
    group by r.rating_result, rc.source, rc.description,bg.billing_group_id
    order by r.rating_result
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE     9.2.0.8.0     Production
    TNS for Solaris: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production
    SQL>
    Above select query took only 10 mins when those nvl functions where not there..
    but when these nvl fuctions are added this takes lot of time....
    please help to optimce it..
    first i tried with is null.. it took lot of time.. ten i replaced it with nvl function...
    please somebody help to optimize this query

    Check out these links:
    {message:id=1812597}
    {thread:id=863295}

  • Please , Help me for installing Oracle 8.1.5 on Redhat Linux 7.0

    Hi every body
    when I run ./runInstaller from cdrom
    I get this messages :
    Initializing Java Virtual Machine from /usr/local/jre/bin/jre.Please wait ...
    Error in CreateOUIProcess ():-1
    : Bad Address
    I use JDK-1-1-6.
    Thx
    null

    I have done some oracle installations over RedHat 7.0 (not certificated):
    Let's check some things:
    1- You must have changed very few parameters on your shm.h sem.h files which are in /usr/include/linux directory.
    2- You need to upgrade the glibc and libstdc libraries (.rpm)
    3- You must have installed the jre116_v5 on /usr/jre and made a symbolic link like this
    ln -s /usr/jre/jre116_v5 /usr/local/jre
    4- You must include in the CLASSPATH parameter the jre116_v5 directory. It should look something like this
    CLASSPATH=/usr/jre/jre116_v5:$ORACLE_HOME/jlib
    5- Be sure to create and export all the parameters in your .bash_profile.
    6- Run the ./runInstaller.sh in a terminal window inside the Xwindow.
    You can find the jre116_v5 in www.backdown.org
    I hope these tips help you
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by xx:
    Hi every body
    when I run ./runInstaller from cdrom
    I get this messages :
    Initializing Java Virtual Machine from /usr/local/jre/bin/jre.Please wait ...
    Error in CreateOUIProcess ():-1
    : Bad Address
    I use JDK-1-1-6.
    Thx<HR></BLOCKQUOTE>
    null

  • Please Help:  A Problem With Oracle-Provided 'Working' Example

    A Problem With Oracle-Provided 'Working' Example Using htp.formcheckbox
    I followed the simple steps in the Oracle-provided example:
    Doc ID: Note:116534.1
    Subject: How to use checkbox in webdb for bulk update using webdb report
    However, when I select a checkbox and click on the Update button, I get a "ORA-01036: illegal variable name/number" error. Please advise. This was a very promising feature.
    Fred
    Below are step-by-step instructions provided by Oracle to create this "working" example:
    How to use a checkbox in WEBDB 2.2 report for bulk update.
    PURPOSE
    This article shows how checkbox can used placed on WEBDB report
    and how to use it.
    SCOPE & APPLICATION
    The following example to guide through the steps to create a working
    example of this.
    In this example, the checkbox is used to select the records. On clicking
    the update button, the pl/sql procedure is called which will update col1 to
    the string 'OK'.
    After the update is done, the PL/SQL procedure calls the report again.
    Since the report only select records where col1 is null, the updated
    records will not be displayed when the report is called again.
    Step 1 - Create Table
    From Sqlplus, log in as scott/tiger and execute the following:
    drop table chkbox_example;
    create table chkbox_example
    (id varchar2(10) not null,
    comments varchar2(20),
    col1 varchar2(10));
    Step 2 - Insert Test Data
    From Sqlplus, still logged in as scott/tiger , execute the following:
    declare
    l_i number;
    begin
    for l_i in 1..50 loop
    insert into chkbox_example values (l_i, 'Comments ' || l_i , NULL);
    end loop;
    commit;
    end;
    Step 3 -Create SQL Query based WEBDB report
    Logon to a WEBDB site which has access to the database the above tables are created.
    Create a SQL based Report.
    Name the report :RPT_CHKBOX
    The select statement for the report is :
    select c.id, c.comments, c.col1,
    htf.formcheckbox('p_qty',c.id) Tick
    from SCOTT.chkbox_example c
    where c.col1 is null
    In Advanced PL/SQL, (REPORT, Before displaying the form), put the following code
    htp.formOpen('scott.chkbox_process');
    htp.formsubmit('p_request','Update');
    htp.br;
    htp.br;
    Step 4 - Create a stored procedure in the database
    Log on to the database as scott/tiger and execute the following to create the
    procedure.
    Note: Replace WEBDB to the appropriate webdb user for your installation.
    In my database, I had installed webdb using WEBDB username, hence user webdb owns
    the packages.
    create or replace procedure chkbox_process
    ( p_request in varchar2 default null,
    p_qty in wwv_utl_api_types.vc_arr ,
    p_arg_names in wwv_utl_api_types.vc_arr ,
    p_arg_values in wwv_utl_api_types.vc_arr
    is
    i number;
    begin
    for i in 1..p_qty.count loop
    if p_qty(i) is not null then
    begin
    update chkbox_example
    set col1 = 'OK'
    where chkbox_example.id = p_qty(i);
    end;
    end if;
    end loop;
    commit;
    /* To Call Report again after updating */
    SCOTT.RPT_CHKBOX.show
    (p_request=>'Run Report',
    p_arg_names=>webdb.wwv_standard_util.string_to_table2(' '),
    p_arg_values=>webdb.wwv_standard_util.string_to_table2(' '));
    end;
    Summary
    There are essentially 2 main modules, The WEBDB report and the pl/sql procedure (chkbox_process)
    A button is created via the advanced pl/sql coding which shows on top of the report. (The
    button cannot be placed at the bottom of the report due to the way WEBDB creates the procedure
    internally)
    When any button is clicked on the report, it calls the pl/sql procedure chkbox_process.
    The procedure is called , WEBDB always passes the parameters p_request,p_arg_names and o_arg_values.
    p_qty is another parameter that we are passing additionally, This comes from the checkbox created
    using the htf.formcheckbox in the report select statement.
    The pl/sql procedure calls the report again after processing. This is done to
    show how to call the report.
    Restrictions:
    -The Next and Prev buttons on the report will not work.
    So it is important that the report can fit in 1 page only.
    (This may mean that you will not select(not ticked) 'Paginate' under
    'Display Option' in the WEBDB report. If you do this,
    then in Step 4, remove p_arg_names and p_arg_values as input parameters
    to the chkbox_process)

    If your not so sure you can use the instanceof
    insurance,
    Object o = evt.getSource();
    if (o instanceof Button) {
    Button source = (Button) o;
    I haven't thoroughly read the thread, but I use something like this:if (evt.getSource() == someObjRef) {
        // do that voodoo
    ]I haven't looked into why you'd be creating a new reference...

  • Gurus, please help I am getting oracle.apps.fnd.cache.CacheException

    Hi, I am not a newbie to OAF. I have worked good amount on the OAF 9i development. Currently we are on R12.0.4 and Jdev 10g (patch 6908968) But this error really beats me. I believe it could be due to a Apache error, but may be I am doing something wrong here and so hopefully you can provide me some insight. I am trying to configure my JDev 10G for R12 development. I am trying to run supplied HelloWorld page in Tutorial.jpr. I have set the DB connection and provided the username/password with responsibility key and also the DBC file in the Runtime Connections properties for the Project. I have also tried the alternative i.e building a custom HelloWorld, but even with that I get the same error.
    Please let me know if I should be doing anything else.
    Thanks and appreciate your help.
    Rahul
    ---------------------------------------------------Error ------------------------------------------------------------------------
    racle.apps.fnd.cache.CacheException     
    at oracle.apps.fnd.cache.AppsCache.get(AppsCache.java:228)     
    at oracle.apps.fnd.profiles.Profiles.getProfileOption(Profiles.java:1485)     
    at oracle.apps.fnd.profiles.Profiles.getProfile(Profiles.java:354)     
    at oracle.apps.fnd.profiles.ExtendedProfileStore.getSpecificProfileFromDB(ExtendedProfileStore.java:211)     
    at oracle.apps.fnd.profiles.ExtendedProfileStore.getSpecificProfile(ExtendedProfileStore.java:171)     
    at oracle.apps.fnd.profiles.ExtendedProfileStore.getProfile(ExtendedProfileStore.java:148)     
    at oracle.apps.fnd.common.logging.DebugEventManager.configureUsingDatabaseValues(DebugEventManager.java:1259)     
    at oracle.apps.fnd.common.logging.DebugEventManager.configureLogging(DebugEventManager.java:1114)     
    at oracle.apps.fnd.common.logging.DebugEventManager.internalReinit(DebugEventManager.java:1083)     
    at oracle.apps.fnd.common.logging.DebugEventManager.reInitialize(DebugEventManager.java:1050)     
    at oracle.apps.fnd.common.logging.DebugEventManager.reInitialize(DebugEventManager.java:1037)     
    at oracle.apps.fnd.common.AppsLog.reInitialize(AppsLog.java:595)     
    at oracle.apps.fnd.common.AppsContext.initLog(AppsContext.java:941)     
    at oracle.apps.fnd.common.AppsContext.initializeContext(AppsContext.java:926)     
    at oracle.apps.fnd.common.AppsContext.initializeContext(AppsContext.java:891)     
    at oracle.apps.fnd.common.WebAppsContext.<init>(WebAppsContext.java:1027)     
    at oracle.apps.fnd.common.WebRequestUtil.validateContext(WebRequestUtil.java:223)     
    at OAErrorPage.jspService(_OAErrorPage.java:66)     [OAErrorPage.jsp]     
    at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.3.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)     
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)     
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)     
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)     
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)     
    at oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.EvermindPageContext.handlePageThrowable(EvermindPageContext.java:847)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.EvermindPageContext.handlePageException(EvermindPageContext.java:813)     
    at runregion.jspService(_runregion.java:197)     [runregion.jsp]     
    at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.3.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)     
    at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)     
    at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)     
    at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)     
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)     
    at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)     
    at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239)     
    at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34)     
    at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880)     
    at com.evermind[Oracle Containers for J2EE 10g (10.1.3.3.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:298)     
    at java.lang.Thread.run(Thread.java:595)Caused by: oracle.apps.jtf.base.resources.FrameworkException: Error in IAS Cache: java.lang.NullPointerException: null Connection     at oracle.apps.jtf.cache.IASCacheProvider.get(IASCacheProvider.java:712)     
    at oracle.apps.jtf.cache.CacheManager.getInternal(CacheManager.java:4802)     
    at oracle.apps.jtf.cache.CacheManager.get(CacheManager.java:4624)     
    at oracle.apps.fnd.cache.AppsCache.get(AppsCache.java:216)     
    ... 50 moreCaused by: oracle.apps.jtf.base.resources.FrameworkException: An exception occurred in the method CacheAccess.getnullThe base exception is:null Connection     
    at oracle.apps.jtf.base.resources.FrameworkException.convertException(FrameworkException.java:607)     
    at oracle.apps.jtf.base.resources.FrameworkException.addException(FrameworkException.java:585)     
    at oracle.apps.jtf.base.resources.FrameworkException.<init>(FrameworkException.java:66)     
    at oracle.apps.jtf.base.resources.FrameworkException.<init>(FrameworkException.java:88)     
    at oracle.apps.jtf.base.resources.FrameworkException.<init>(FrameworkException.java:202)     
    at oracle.apps.jtf.base.resources.FrameworkException.<init>(FrameworkException.java:218)     
    at oracle.apps.jtf.base.resources.FrameworkException.<init>(FrameworkException.java:249)     ... 54 more
    -------------------------------------------------------------------------------------------------------------------------------------------------

    I did thought it was a DBC issue before, so I requested the DBC file again from the DBA's. I try the page and get the same error again. This time I looked at the DBC and compared the JDBC string with what I have on the TNSNames. The server name on the DBC file provided to me was slightly off. So, that was the error. The dbc file had imbcdd-d as the server name, whereas in the TNSName it was imbcdd-b. I fixed the DBC and reran and there it goes I get the HelloWorld Page.
    Thanks a bunch to all. I should have it investigated more. Apologize for the siilly post.
    Rahul

  • Please Help in query

    SELECT PEE2.ASSIGNMENT_ID,--,PEEV2.EFFECTIVE_START_DATE,
    PET.ELEMENT_NAME,NVL(MAX(PEEV2.SCREEN_ENTRY_VALUE),0)SALARY
    --PEE2.EFFECTIVE_START_DATE PEE_START
    FROM PAY_ELEMENT_ENTRIES_F PEE2,PAY_ELEMENT_ENTRY_VALUES_F PEEV2 , PAY_ELEMENT_TYPES_F PET
    WHERE PEE2.ELEMENT_TYPE_ID = PET.ELEMENT_TYPE_ID
    AND PEE2.ELEMENT_ENTRY_ID=PEEV2.ELEMENT_ENTRY_ID
    AND PET.ELEMENT_NAME IN('BASIC_SALARY','AL_CONVEYANCE','AL_TEA','AL_COLA')
    AND PEEV2.SCREEN_ENTRY_VALUE IS NOT NULL
    AND (PEE2.ASSIGNMENT_ID,PEEV2.EFFECTIVE_START_DATE)=(
    SELECT PEE.ASSIGNMENT_ID,MAX(PEEV.EFFECTIVE_START_DATE)
    FROM PAY_ELEMENT_ENTRIES_F PEE,PAY_ELEMENT_ENTRY_VALUES_F PEEV
    WHERE PEE.ELEMENT_ENTRY_ID=PEEV.ELEMENT_ENTRY_ID
    AND PEE.ASSIGNMENT_ID=:ASSIGNMENT_ID
    AND PEE.ELEMENT_TYPE_ID = PET.ELEMENT_TYPE_ID
    AND PET.ELEMENT_NAME IN('BASIC_SALARY','AL_CONVEYANCE','AL_TEA','AL_COLA')
    AND PEEV.SCREEN_ENTRY_VALUE IS NOT NULL
    GROUP BY PEE.ASSIGNMENT_ID
    )GROUP BY ASSIGNMENT_ID , PET.ELEMENT_TYPE_ID , PET.ELEMENT_NAME
    output is
    ASSIGNMENT_ID     ELEMENT_NAME     SALARY
    117     AL_COLA     650
    117     AL_CONVEYANCE     1180
    117     AL_TEA     172
    117     BASIC_SALARY     7820
    but i want the output like this
    ASSIGNMENT_ID ------AL_COLA------AL_CONVEYANCE------AL_TEA-------BASIC_SALARY
    117---------------------------650-------------------1180----------------------172-----------7820
    PLZZ HELP NO HARDCODE PLZZ ONLY DYNAMIC QUERY REQUIRED AND NO PL/SQL USED..
    REGARDS
    RANCHOO

    Hi,
    Since you didn't post any tables, I'll use the scott.emp table to show you how to get results like that.
    Let's say we're interested in this data:
    SELECT       deptno
    ,       job
    ,       sal
    FROM       scott.emp
    ORDER BY  deptno
    ,     job
        DEPTNO JOB              SAL
            10 CLERK           1300
            10 MANAGER         2450
            10 PRESIDENT       5000
            20 ANALYST         3000
            20 ANALYST         3000
            20 CLERK           1100
            20 CLERK            800
            20 MANAGER         2975
            30 CLERK            950
            30 MANAGER         2850
            30 SALESMAN        1250
            30 SALESMAN        1250
            30 SALESMAN        1600
            30 SALESMAN        1500Let's say we want to get a total sal for each deptno and job, aned present it as a cross-tab, with a row for every deptno and a column for every job. As Karthick pointed out, that requires dynamic SQL, so let's just take the first 4 jobs in alphabetic order. The query below numbers the jobs 1, 2, 3, ... in alphabetic order, then uses that number to consider only a certain job in each column.
    WITH     got_jnum    AS
         SELECT       deptno
         ,       job
         ,       sal
         ,       DENSE_RANK () OVER (ORDER BY job)     AS jnum
         FROM       scott.emp
    SELECT       deptno
    ,       TO_CHAR (SUM (CASE WHEN jnum = 1 THEN sal END), '99999999')     AS job_1
    ,       TO_CHAR (SUM (CASE WHEN jnum = 2 THEN sal END), '99999999')     AS job_2
    ,       TO_CHAR (SUM (CASE WHEN jnum = 3 THEN sal END), '99999999')     AS job_3
    ,       TO_CHAR (SUM (CASE WHEN jnum = 4 THEN sal END), '99999999')     AS job_4
    FROM       got_jnum
    GROUP BY  deptno
        UNION ALL
    SELECT       NULL                                   AS deptno
    ,       MIN (CASE WHEN jnum = 1 THEN LPAD (job, 9) END)     AS job_1
    ,       MIN (CASE WHEN jnum = 2 THEN LPAD (job, 9) END)     AS job_2
    ,       MIN (CASE WHEN jnum = 3 THEN LPAD (job, 9) END)     AS job_3
    ,       MIN (CASE WHEN jnum = 4 THEN LPAD (job, 9) END)     AS job_4
    FROM       got_jnum
    ORDER BY  deptno     NULLS FIRST
        DEPTNO JOB_1     JOB_2     JOB_3     JOB_4
                 ANALYST     CLERK   MANAGER PRESIDENT
            10                1300      2450      5000
            20      6000      1900      2975
            30                 950      2850A lot of the complexity in the query above involves getting the row with the actual job names. If you knew what they were, you could hard-colde them into the query; then you woldn't need the second part of the UNION, and therefore you wouldn't need TO_CHAR.
    This is called a Pivot . Search for "Pivot" (or, as Karthick suggested "Rows to Columns") to see more examples and explanations.
    If you really want a variable number of columns, then you need dynamic SQL, as Karthick explained. This isn't very hard, as dynamic SQL goes. You just need to have a preliminary query determine what the jobs are, and write an appropriate SUM expression (with column alias) to use in the SELECT clause. See [this thread|http://forums.oracle.com/forums/message.jspa?messageID=3227306] for an example.
    Another way to get a variable number of jobs is to use String Aggregation , where all the data about all the jobs is combined in one giant string column. That huge string can be formatted so that it looks like separate columns. [This site|http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php] has a good summary of different String Aggregation techniques.

  • Please help - Recursive Query Restrictions

    Hi All,
    I wanted to know what restrictions are placed on Oracle Recursive Query capability. Any help or links in this regards would be highly appreciated. Waiting to hear from you.
    Thanks,
    Snehal

    Can't think of anything I would term a restriction off the top of my head. There are a few notes in the SQL Reference about precedence that probably aren't obvious.
    Are you having a particular problem with this syntax?
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Please Help - Compiler Problems with Oracle 10

    I have developed a application using OCCI on Oracle 9i. As requested I have used the SUN FORTE WORKSHOP 6.2 C++ Compiler. Now my customer has decided to go on Oracle 10.
    It's easy - at least that was it what i thought :)
    If I try to compile & link the application with ORACLE 10 I get the following message: "Error Code 1: Input file /export/opt/SUNWspro/WS6U2/lib/drti.o contains 32-bit reloctable, but producing a 64-bit file.
    Do I need the SUN ONE Studio 8 C++ Compiler? What is the difference between Sun ONE Studio 8 & Sun FORTE ??
    Thans in advance to all who can help me.

    Anton,
    Sun ONE Studio 8 will be required for creating 64-bit OCCI applications. If you want to create a 32-bit application, then please check $ORACLE_HOME/rdbms/demo/demo_rdbms32.mk. The 32 bit libraries are installed under $ORCLE_HOME/rdbms/lib32.
    Regards.

  • Please help: trying to install Oracle 8.1.6.0 on Mandrake 8.1

    Hi, I am trying to install Oracle8i that comes with "Oracle for Linux Starter Kit" on Mandrake 8.1. Could someone please give tips or pointer how i can accomplish this? The Universal Installer starts fine, but then a dialog pops up about compiling sqlplus. here is a piece from the log file:
    Calling action unixActions1.7.0.17.0 make
         installMakePath = /usr/bin/make
         installMakeFileName = /usr/oracle/sqlplus/lib/ins_sqlplus.mk
         installTarget = install
         undoMakeFileName =
         installArguments = ORACLE_HOME=/usr/oracle,
         logFile = /usr/oracle/install/make.log
         undoTarget =
    Exception thrown from action: make
    Exception Name: MakefileException
    Exception String: Error in invoking target install of makefile /usr/oracle/sqlplus/lib/ins_sqlplus.mk
    Exception Severity: 1
    Exception thrown from action: make
    Exception Name: MakefileException
    Exception String: Error in invoking target install of makefile /usr/oracle/sqlplus/lib/ins_sqlplus.mk
    Exception Severity: 1
    Exception thrown from action: make
    Exception Name: MakefileException
    Exception String: Error in invoking target install of makefile /usr/oracle/sqlplus/lib/ins_sqlplus.mk
    Exception Severity: 1
    Calling action unixActions1.7.0.17.0 make
         installMakePath = /usr/bin/make
         installMakeFileName = /usr/oracle/network/lib/ins_net_client.mk
         installTarget = install
         undoMakeFileName =
         installArguments = ORACLE_HOME=/usr/oracle,
         logFile = /usr/oracle/install/make.log
         undoTarget =
    Exception thrown from action: make
    Exception Name: MakefileException
    Exception String: Error in invoking target install of makefile /usr/oracle/network/lib/ins_net_client.mk
    Exception Severity: 1
    *** Cancel Dialog: ***
    User selected: Stop installation of all products.
    Error in invoking target install of makefile /usr/oracle/network/lib/ins_net_client.mk
    Unable to read /usr/oraInventory/oraInventory/Contents/OracleHomesList.ser. Some inventory information may be lost.
    Unable to read /usr/oraInventory/oraInventory/Contents/LibsList.ser. Some inventory information may be lost.

    I had the same problem with Oracle 9i on Mandrake 8.1. I am not sure if the same fix will work or not. See my 9i on 8.1 notes at:
    http://members.home.net/joseph.j.flynn/oracle.htm
    snip---
    You will get a link error after all of the copying and unpacking has been done somewhere in disk 3. Leave the error message up on the screen and go edit the $ORACLE_HOME/bin/genclntsh script. Blank out the LD_SELF_CONTAINED env var. Save and execute the script. Hit the retry button on the installer. The alternative approach to this involves downgrading the binutils but that seemed to get awfully messy to me. (thanks to a post from Helmut Seruega for this fix)

  • Please help with query for 5 lastest opening balance  !!!!!!!!!!!

    Can anyone plese tell me or guide me how to write the query to show the 5 lastest opening balance from the A/R invoice on the specific BP partner?
    Example
    The box to input "BP partner"
    and then show,
    Lastest transaction | Ship date | Invoice number | Balance Amount | Culmulative
    1    
    2
    3
    4
    5
    Your help will be very very appreciated.

    This is very good but I would like to show only the top 5 remaining invoice. I think that I have to combine it with JDT1. I have seen one query that may be able to apply on my case.
    SELECT
    T1.CardCode + '' AS 'BP Code',
    T2.Notes2 AS 'BP Name',
    T0.RefDate,
    CASE
         WHEN T0.TransType = 13 THEN 'IN'
         WHEN T0.TransType = 14 THEN 'CN'
         WHEN T0.TransType = 30 THEN 'JE'
         WHEN T0.TransType = 24 THEN 'RC'
         WHEN T0.TransType = 46 THEN 'PS'
         ELSE 'Error ! ! !'
    END AS 'Doc Type',
    T0.Ref1 'Doc. Number',
    ISNULL(T0.FCCurrency, ' - ') AS 'Ccy',
    (T0.BalFcDeb - T0.BalFcCred) AS 'Bal. F. Ccy',
    (T0.BalDueDeb - T0.BalDueCred) AS 'Bal. Rs',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') <= -1)                     ,0) AS 'Future',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') = 0)                         ,0) AS 'Current Mth',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') = 1)                         ,0) AS '1 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') = 2)                         ,0) AS '2 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate ,'[%1]') = 3)                         ,0) AS '3 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') between 4 and 6)    ,0) AS '4 - 6 Mth Ago',
    ISNULL((SELECT T0.BalDueDeb -T0.BalDueCred WHERE DateDiff(mm, T0.RefDate, '[%1]') >= 7)                       ,0) AS '>7 Mth Ago'
    FROM JDT1 T0
    INNER JOIN OCRD T1 ON T0.ShortName = T1.CardCode
    LEFT OUTER JOIN OCPR T2 ON T1.CardCode = T2.Cardcode
    LEFT OUTER JOIN OJDT T3 ON T0.TransID = T3.TransID
    LEFT OUTER JOIN OINV  T4 ON T3.TransID = T4.TransID
    LEFT OUTER JOIN ORIN  T5 ON T3.TransID = T5.TransID
    WHERE
    T1.CardType = 'C' and Balance != 0
    and (T0.BalDueDeb - T0.BalDueCred) != 0
    but still try to figure it out....

  • Please Help this query should be simple :)

    Here is what I have written so far: Basically I want it to return all the locations like I have specified that do not have DA-REPL in the area_code table but it is just returning everything it seems.
    select l.location_no, l.zone_code, la.area_code
    from move.location l, move.location_area la
    where la.location_no = l.location_no
    and l.zone_code = 'Z-BIN'
    and (l.location_no like '%%-%%-2%%' or l.location_no like '%%-%%-1%%')
    and la.area_code != 'DA-REPL'
    order by 1
    Here is what my results look like:
    60-02-101     Z-BIN     WA-60
    60-02-101     Z-BIN     WA-BIN
    60-02-101     Z-BIN     WA-BINRESV
    60-02-101     Z-BIN     WA-PALLET
    60-02-102     Z-BIN     WA-60
    60-02-102     Z-BIN     WA-BIN
    60-02-102     Z-BIN     WA-BINRESV
    60-02-102     Z-BIN     WA-PALLET
    60-02-201     Z-BIN     WA-60
    60-02-201     Z-BIN     WA-BIN
    60-02-201     Z-BIN     WA-BINRESV
    60-02-201     Z-BIN     WA-PALLET
    Edited by: 906043 on Feb 20, 2012 2:23 PM

    906043 wrote:
    At it's most basic the query would look like this but this gives me 67,834 results I am dealing with a pretty big warehouse with many "la.area_code" entries I am only trying to get the locations in a specific zone('Z-BIN') that do not have 'DA-REPL' as an la.area_code as this would cause that location never to get replenishments when it becomes empty.
    select l.location_no, l.zone_code, la.area_code
    from move.location l, move.location_area la
    where la.location_no = l.location_no
    l.zone_code = 'Z=BIN'
    and la.area_code != 'DA-REPL'
    order by 1
    Not sure if that helps anymore I am at a loss but still plugging away :)A little attention to code formatting could bring some sanity to yourself. Enclosing that formatted code in the code tags on this forum would bring a lot of sanity to those trying to help you:
    select l.location_no
    ,      l.zone_code
    ,      la.area_code
    from move.location l
    ,    move.location_area la
    where la.location_no = l.location_no
          l.zone_code = 'Z=BIN'
    and   la.area_code != 'DA-REPL'
    order by 1And once it is formatted for easier reading by humans, it's easier to see that you are missing an "and" (maybe "or"?) in your WHERE clause.

  • Please help, simple query not working

    Have the following script that I would like to run at multiple sites and create table columns if necessary:
    DECLARE
    table_name VARCHAR2 (30) := 'SITE_STATISTICS';
    column_name VARCHAR2 (30) := 'SITE_MONTH';
    column_data_type VARCHAR2 (30) := 'DATE';
    column_count INTEGER;
    dynamic_sql VARCHAR2 (4000);
    BEGIN
    SELECT COUNT (1)
    INTO column_count
    FROM SYS.USER_TAB_COLUMNS utc
    WHERE utc.table_name = table_name AND utc.column_name = column_name AND utc.data_type = column_data_type;
    SYS.DBMS_OUTPUT.ENABLE (4000);
    IF column_count = 0 THEN
    dynamic_sql :=
    ALTER TABLE SITE_STATISTICS ADD (SITE_MONTH DATE);
    EXECUTE IMMEDIATE dynamic_sql;
    ELSE
    DBMS_OUTPUT.put_line ('Not running Dynamic Sql, found ' || column_count || ' corresponding rows in sys.user_tab_columns');
    END IF;
    END;
    EXIT;
    At a given site I do not have the given column, and running the select from sys.user_tab_columns manually returns 0 rows. However, when I run this script it outputs the following:
    Not running Dynamic Sql, found 128 corresponding rows in sys.user_tab_columns
    What's going on!?

    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create table abc (c1 number(10));
    Table created.
    SQL> DECLARE
      2     table_name1                   VARCHAR2 ( 30 ) := 'ABC';
      3     column_name1                  VARCHAR2 ( 30 ) := 'SITE_MONTH';
      4     column_data_type1             VARCHAR2 ( 30 ) := 'DATE';
      5     column_count                  INTEGER;
      6     dynamic_sql                   VARCHAR2 ( 4000 );
      7  BEGIN
      8     SELECT COUNT ( 1 )
      9       INTO column_count
    10       FROM SYS.user_tab_columns utc
    11      WHERE utc.table_name = table_name1
    12        AND utc.column_name = column_name1
    13        AND utc.data_type = column_data_type1;
    14  
    15     SYS.DBMS_OUTPUT.ENABLE ( 4000 );
    16  
    17     IF column_count = 0 THEN
    18  
    19        dynamic_sql :='ALTER TABLE ABC ADD (SITE_MONTH DATE,SHIP_CONTANK INTEGER,SHIP_CONRAIL INTEGER)';
    20  
    21        EXECUTE IMMEDIATE dynamic_sql;
    22     ELSE
    23        DBMS_OUTPUT.put_line (    'Not running Dynamic Sql, found '
    24                               || column_count
    25                               || ' corresponding rows in sys.user_tab_columns'
    26                             );
    27     END IF;
    28  END;
    29  /
    PL/SQL procedure successfully completed.
    SQL> desc abc
    Name                                      Null?    Type
    C1                                                 NUMBER(10)
    SITE_MONTH                                         DATE
    SHIP_CONTANK                                       NUMBER(38)
    SHIP_CONRAIL                                       NUMBER(38)

Maybe you are looking for