Problem in designing an SQL or PL/SQL

Hi all,
This is my problem statement....
I have a query that gives me output like this..i cannot change this query...the result is coming from 2 independent tables.....
accountid effective date term date
1 01/01/07 01/16/07
1 01/01/07 01/20/07
1 01/16/07 01/30/07
1 01/20/07 02/02/07
1 01/30/07 02/02/07
1 02/02/07 NULL
1 02/02/07 NULL
i should have my result as below.
accountid effective date term date
1 01/01/07 01/16/07
1 01/16/07 01/20/07
1 01/20/07 01/30/07
1 01/30/07 02/02/07
1 02/02/07 NULL
i taught of the following logic to derive the output...
will group by accountid and effective date and order by effctive date....change all my term dates to null and load term date from the effective date of the next record...
but i am not able to come up with an SQL or PL/SQL for doing the same..
Can anyone let me know whether it is possible to do this..
Regards
Bharath

Try this. I used analytics. You said you can't change the SQL which produces your source data so replace my test sql with your actual SQL.
with test as (
     select  1 acct_id, to_date('01/01/07','mm/dd/yy') eff_dt, to_date('01/16/07','mm/dd/yy') term_dt from dual
      union all
     select  1 ,to_date('01/01/07','mm/dd/yy'), to_date('01/20/07','mm/dd/yy') term_dt from dual
      union all
     select  1, to_date('01/16/07','mm/dd/yy'), to_date('01/30/07','mm/dd/yy') term_dt from dual
      union all
     select  1, to_date('01/20/07','mm/dd/yy'), to_date('02/02/07','mm/dd/yy') term_dt from dual
      union all
     select  1, to_date('01/30/07','mm/dd/yy'), to_date('02/02/07','mm/dd/yy') term_dt from dual
      union all
     select  1, to_date('02/02/07','mm/dd/yy'), NULL from dual
      union all
     select  1, to_date('02/02/07','mm/dd/yy'), NULL from dual
select acct_id, eff_dt, max (eff_dt) over ( partition by 1 order by acct_id, eff_dt  rows between 1 following and 1 following)
from   test
group  by acct_id, eff_dt
   ACCT_ID EFF_DT    MAX(EFF_D
         1 01/JAN/07 16/JAN/07
         1 16/JAN/07 20/JAN/07
         1 20/JAN/07 30/JAN/07
         1 30/JAN/07 02/FEB/07
         1 02/FEB/07

Similar Messages

  • Problem in design the sql query

    Hi,
    I have following requirement on sql
    table 1 time and table 2 person entry in class room
    time date column
    entries time date column
    tab1 tab2
    time room no entries_time
    09:00 1 09:00
    09:15 1 09:15
    09.30 null null
    09:45 null null
    10.00 null null
    I want to display last entry time for every time column, i mean output like
    time room no entries_time
    09:00 1 09:00
    09:15 1 09:15
    09.30 1 09:15
    09:45 1 09:15
    10.00 1 09:15
    10.15 1 09:15
    10.30 1 09:15
    Regards,
    Ram

    CREATE TABLE "TAB1"
    ("REF_TIME" DATE NOT NULL ENABLE
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.00.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.01.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.02.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.03.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.04.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.05.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.06.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.07.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.08.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.09.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.10.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.11.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.12.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.13.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.14.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.15.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.16.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.17.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.18.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.19.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.20.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.21.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB1 (REF_TIME) values (to_date('25-JUN-2012 12.22.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    commit;
    CREATE TABLE "TAB2"
    ("ROOM_NO" NUMBER, "TIME" DATE NOT NULL ENABLE
    Insert into TAB2 (ROOM_NO,TIME) values (1,to_date('25-JUN-2012 12.00.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB2 (ROOM_NO,TIME) values (1,to_date('25-JUN-2012 12.02.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB2 (ROOM_NO,TIME) values (1,to_date('25-JUN-2012 12.03.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB2 (ROOM_NO,TIME) values (1,to_date('25-JUN-2012 12.04.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB2 (ROOM_NO,TIME) values (1,to_date('25-JUN-2012 12.10.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    Insert into TAB2 (ROOM_NO,TIME) values (1,to_date('25-JUN-2012 12.15.00 AM','DD-MON-YYYY HH.MI.SS AM'));
    commit;
    output need in this format
    12.00.00 AM     1     12.00.00 AM
    12.01.00 AM     1     12.00.00 AM
    12.02.00 AM     1     12.02.00 AM
    12.03.00 AM     1     12.03.00 AM
    12.04.00 AM     1     12.04.00 AM
    12.05.00 AM     1     12.04.00 AM
    12.06.00 AM     1     12.04.00 AM
    12.07.00 AM     1     12.04.00 AM
    12.08.00 AM     1     12.04.00 AM
    12.09.00 AM     1     12.04.00 AM
    12.10.00 AM     1     12.10.00 AM
    12.11.00 AM     1     12.10.00 AM
    12.12.00 AM     1     12.10.00 AM
    12.13.00 AM     1     12.10.00 AM
    12.14.00 AM     1     12.10.00 AM
    12.15.00 AM     1     12.15.00 AM
    12.16.00 AM     1     12.15.00 AM
    12.17.00 AM     1     12.15.00 AM
    12.18.00 AM     1     12.15.00 AM
    12.19.00 AM     1     12.15.00 AM
    12.20.00 AM     1     12.15.00 AM
    12.21.00 AM     1     12.15.00 AM
    12.22.00 AM     1     12.15.00 AM
    Thanks

  • Designer pl/sql web forms - 11g compatibility

    Quick question for all...
    Has anyone attempted or encountered problems when generating Designer pl/sql web forms into 11g database?
    thanks!

    All my Web PL/SQL generator stuff is in 10g R2. I did have to make sure that I ran the Web PL/SQL installer to make sure I had the latest versions of the WSGL package and its companions.
    Why? Are you having a problem?

  • I have problem with login in sql Server give me support .pre login handshake

    I have problem with login in sql Server give me support .pre login handshake

    The following threads are on the same topic:
    http://www.sql-server-performance.com/forum/threads/pre-login-handshake-error-when-connecting-to-db.687/
    http://stackoverflow.com/questions/12308340/sql-server-2000-connection-error-pre-login-handshake
    http://dbaspot.com/sqlserver-server/458011-error-occurred-during-pre-login-handshake-microsoft-sql-server-error-10054-a.html
    Kalman Toth Database & OLAP Architect
    IPAD SELECT Query Video Tutorial 3.5 Hours
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Oracle 11gR2 to SQL Server 2008 R2 - Problem executing SP on SQL server

    Hi,
    I have this problem: Executing a sp in SQL server from oracle
    --------------------ORACLE SP--------------------
    create or replace
    PROCEDURE DRIVER_SP
    AP IN OUT appl_param%ROWTYPE
    as
    v_sp_name varchar2(50);
    v_control_id number;
    val VARCHAR2(100);
    cur INTEGER;
    nr INTEGER;
    BEGIN
    v_sp_name := ap.MESSAGE_MISC_TEXT;
    v_control_id := ap.control_id;
    cur := DBMS_HS_PASSTHROUGH.OPEN_CURSOR@dblink_sqlserver;
    DBMS_HS_PASSTHROUGH.PARSE@dblink_sqlserver(cur, 'execute ' || v_sp_name || ' ' || to_char(v_control_id));
    LOOP
    nr := DBMS_HS_PASSTHROUGH.FETCH_ROW@dblink_sqlserver(cur);
    EXIT WHEN nr = 0;
    DBMS_HS_PASSTHROUGH.GET_VALUE@dblink_sqlserver(cur, 1, val);
    END LOOP;
    DBMS_HS_PASSTHROUGH.CLOSE_CURSOR@dblink_sqlserver(cur);
    driver_ap01_log_msg('Procedure returned: ' || val);
    commit;
    exception
    when others then
    driver_ap01_log_msg(sqlerrm);
    END DRIVER_SP;
    --------------------SQL Server SP-----------------------
    ALTER PROCEDURE [dbo].[PA01_SP]
    @control_id integer
    AS
    begin
    --update PA01
    --set infile_control_id = @control_id
    --insert into dbo.PA01LOG(msg) values('test')
    select 0
    end
    THE PROBLEM: Oracle SP calls SQL Server SP and any time I try to INSERT/UPDATE/DELETE (DML) within SQLServer SP it throws an exception on Oracle's end. Once I comment all DML code the proc runs fine.
    +"ORA-28511: lost RPC connection to heterogeneous remote agent using SID=ORA-28511: lost RPC connection to heterogeneous remote agent using SID=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xxxxxxx)(PORT=1511))(CONNECT_DATA=(SID=dg4msql)))+
    +ORA-02063: preceding line from DBLINK_SQLSERVER"+
    Please help.
    Thanks

    Thanks for your response, it got me closer to my goal. I'm still facing one problem:
    Let me explain what I need to achieve
    Purpose
    Execute an Oracle stored procedure which in turn executes a stored procedure on remote SQLServer which updates local tables on that SQLServer.
    Observations
    The execution of both procedures completes successfully. However, an explicit COMMIT statement must be issued on the Oracle session which initiated the transaction before any data could be read from the SQLServer updated table.
    The following is test exercise for proof of concept.
    PL/SQL code
    declare
    out_arg integer;
    ret_val integer;
    begin
    out_arg := 0;
    ret_val := "dbo"."ZZZ_SP"@DBLINK_SQLSERVER(10, out_arg);
    dbms_output.put_line(to_char(out_arg));
    end;
    SQLServer code
    ALTER procedure [dbo].[ZZZ_SP] (@arg1 integer, @arg2 integer output)
    AS
    begin tran tran1
    insert into dbo.PA01LOG(msg) values('ddd')
    commit tran tran1
    set @arg2 = @arg1 * 100
    select -1
    GO
    I have put the Oracle gateway in Single_Site mode to avoid two phase commit. I want SQLServer to be able to run its own transaction management. I don't want Oracle to be responsible for completing the transactions which take place within SQLServer.
    I fear there might be a gap in my knowledge.
    Any ideas why I need to issue a COMMIT in Oracle session to release the lock from SQLServer table?
    Thanks

  • How to save landscape print layout for report designed in SQL Server 2005

    How to save page setup for a report wich was designed in SQL Server 2005 RS?  Each time report is previewed, I have to change portrate to landscape orientation and left and right marging from 0,5 to 0,25, to be able to see all fieldas on the report.
    Thanks!

    Hi, Marina;
    Which version of Crystal Reports are you using? Once you set a report to Landscape, and save the report, it should stay that way, unless you change to a different printer.
    Regards,
    Jonathan

  • Problem with connect to sql server ..

    I have problem with connect to sql server2005
    i use jpa(hibernate) and jsf
    javax.servlet.ServletException: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
    root cause
    javax.faces.el.EvaluationException: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: Could not open connection
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1361)
    org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1289)
    org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:1371)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:60)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    org.hibernate.exception.JDBCConnectionException: Could not open connection
    org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)
    org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
    org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:304)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1263)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:57)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    root cause
    java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost;databaseName=MIS
    java.sql.DriverManager.getConnection(Unknown Source)
    java.sql.DriverManager.getConnection(Unknown Source)
    org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl.getConnection(DriverManagerConnectionProviderImpl.java:173)
    org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:276)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
    org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
    org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
    org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
    org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1263)
    org.hibernate.ejb.TransactionImpl.begin(TransactionImpl.java:57)
    servlet.PrzychodniaBean.dodaj(PrzychodniaBean.java:30)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    java.lang.reflect.Method.invoke(Unknown Source)
    org.apache.el.parser.AstValue.invoke(AstValue.java:262)
    org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:278)
    com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
    javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
    com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    javax.faces.component.UICommand.broadcast(UICommand.java:315)
    javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
    javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
    com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
    com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
    persistance.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="PrzychodnieLekarskiePU" transaction-type="RESOURCE_LOCAL">
    <class>model.Przychodznia</class>
    <properties>
    <property name="hibernate.connection.username" value="a"/>
    <property name="hibernate.connection.password" value="a"/>
    <property name="hibernate.connection.url" value="jdbc:sqlserver://localhost;databaseName=MIS"/>
    <property name="hibernate.connection.driver_class" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
    <property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost;databaseName=MIS"/>
    <property name="javax.persistence.jdbc.user" value="a"/>
    <property name="javax.persistence.jdbc.password" value="a"/>
    <property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    </properties>
    </persistence-unit>
    </persistence>
    Edited by: 985713 on 2013-02-02 07:12
    Edited by: 985713 on 2013-02-02 07:37

    it works ok : I don't known where is error in jpa .. ?
    public class MyConnection {
         public static Connection getConnection () throws SQLException{
              String url = "jdbc:sqlserver://ABADDON1;databaseName=MIS";
              String user = "a";
              String pass = "a";
              DriverManager.registerDriver(new com.microsoft.sqlserver.jdbc.SQLServerDriver());
              Connection conn = DriverManager.getConnection(
                        url,user,pass);
              System.out.println("OK");;
              return conn;
    try {
                   conn = MyConnection.getConnection();
                   } catch (SQLException ex) {
                        System.out.println("Error: " + ex.getErrorCode()
                                  + ex.getMessage());
                   }

  • Oracle Designer to SQL Data Modeller Migration

    Hi
    We would like to migrate our artifacts from Oracle Designer to SQL Data Modeller
    Does anybody here have experience with that and things that i should be aware of that is possible with Designer but need to be handled differently in Modeller.

    You might want to try this forum as well: SQL Developer

  • What is the problem with native dynamic sql when counting rows in all table

    what is the problem with native dynamic sql when counting rows in all table?Giving an error "table or view does not exist". Thanks.
    DECLARE
    v_sql_string varchar2(1000);
    v_no_of_rows number;
    BEGIN
    for i in ( select table_name from all_tables )
    loop
    v_sql_string := ' select count(1) from ' || i.table_name;
    dbms_output.put_line( v_sql_string );
    --execute immediate v_sql_string into v_no_of_rows;
    end loop;
    END;

    Usually your problem can be described with 'Who cares'. I mean, for what reason do you do this? I doubt that there's a business need to get 100 % accurate answers for this. Normally such things are used to get a picture about the growth of data.
    Personally I would prefer to have up-to-date statistics for all tables and just query the number of rows from there. Sufficient for me in < 99 % of all cases.
    Just my $ .02...

  • Performance Problem on Designer Repository

    Hello,
    We have performance problem on Designer Repository database, I run system statistics, recreate objects, truncate temporary tablespaces, but compile forms runs very slowly, on top sql is this sql statement:
    SELECT MAX(1)
    FROM I$SDD_WA_CONTEXT CTXT
    WHERE CTXT.OBJECT_IVID = :B1
    AND CTXT.WORKAREA_IRID = JR_CONTEXT.WORKAREA
    AND CTXT.WASTEBASKET = JR_CONTEXT.WASTEBASKET
    how optimize this statement?

    jr_wastebasket.purge_insignificant_versions helps, I drop old versions of forms
    Edited by: Vazha_Mantua on Mar 27, 2009 9:24 AM

  • Problem in designing the complex report for the client requirement

    Post Author: venkateshvarakala
    CA Forum: General
    Hi,
    I have problem in designing the report (Crystal Report 9.0) with multiple groups wih a sub report in each group with a a group header and footer with a
    detail section in each report.
    My requirement is as follows.1) Xxxx-sub reportwill have one header conetnt and footer content and detail ection in the middle grouped on one parameter2) Yyyyysub reportwill have one header conetnt and footer content and detail ection in the middle grouped on one parameter3) Zzzzzsub reportwill have one header conetnt and footer content and detail ection in the middle grouped on one parameter4)ABCdsub reportwill have one header one footer in group headers grouper on two prameters, My requirement demands customised detail section i.e.static conetent followed by detail section and a static conetnt(which should not repeat with child table records,should come only once with the a record and
    s) and detail section.
    example:
    main table of the sub report 4 has records m1,m2,m3,m4... and child table has
    m1c1m,m1c2,m1c3,m1c4,m2c1,m2c2,m2c3,m2c4,m3c1,m3c2,m3c3,m3c4,m4c1,m4c2,m4c3,m4c4...
    The staic content should come only with m1,m2,m3,m4 not with m1c1,m1c2....like this I need in two places in the same report which may have 500 recors printed in single report.
    all the above section should be suppressable with a condition including the top 3 reports.
    I am able to get the top 3 reports as per the requirement but my forth sub report is getting displayed after each sub-group 1,2,3 which is not happening with
    1,2,3. Only 4th set is repeating with 1,2,3.
    THis report is attached with 6 datasets.
    I linked the main report main table with 1,2,3 (main Table) report filling table but when I am trying to link the 4th table main table  I am able to link but
    I am not getting the result on the report.All the dataset has the one common column. sub report 1,2,3 are filled with common datasets with condition suppressing where as 4th report is filled with
    different results .
    1) My question is why the 4 the report is report is repeating with 1,2,3 why 1,2,3 are coming as expected.2) Is it possible to create
    Please help me in designing the report as per the requiremnt and suggest me if I need any design modifictions.
    Your suggestions and inputs are highy appreciated.Thanks for sparing time in going through my problem and I will be grateful if give solution and share if you have similar experiences.
    Thanks
    Venkatesh Varakala.

    If you create a multiprovider with the two ODS you won’t have this problem.
    Hope it helps.
    Regards.

  • ADF 12c Rendering Problems at design time

    Hi all,
    I am experimenting the following unexpected rendering problems at Design time with JDEV 12c:
    -  Sometimes a complete page is showed empty or blank but the components exists on the page (you can see them in the structure panel) and the page has no warnings.
    -  Sometimes I cannot click a component because it is behind the container.
    -  Sometimes the containers are rendered in other place on the page.
    -  Sometimes the containers not stretching
    I remember some posts about this problem in 11.1.2.x but I think it was not fixed in 12c. For this reason, I have some questions:
    What is the "real" memory requirement  of Jdev 12c to avoid render problems?
    What is the best configuration in jdev.conf?
    Is it only a memory issue or Is it also a dependency reference problem? According to a blog post of Frank Nimphius:
    Though with Oracle JDeveloper 11g the problem of the IDE not rendering JSF pages properly in the visual editor has become rare, there always is a way for the creative to break IDE functionality. A possible reason for the visual editor in JDeveloper to break is a failed dependency reference, which often is in a custom JSF PhaseListener configured in the faces-config.xml file. To avoid this from happening, surround the code in your PhaseListener class with the following statement (for example in the afterPhase method)
    public void afterPhase(PhaseEvent phaseEvent) {   if(!ADFContext.getCurrent().isDesigntime()){ ... listener code here ... } }
    The reason why the visual editor in Oracle JDeveloper fails rendering the WYSIWYG view has to do with how the live preview is created. To produce the visual display of a view, JDeveloper actually runs the ADF Faces view in JSF, which then also invokes defined PhaseListeners. With the code above, you check whether the PhaseListener code is executed at runtime or design time.If it is executed in design time, you ignore all calls to external resources that are not available at design time.
    source:
    https://blogs.oracle.com/jdevotnharvest/entry/when_jdeveloper_ide_doesn_t
    if it is a known problem, then Why is not fixed in 12c?
    Jhon
    Jdev 12c

    Jhon, what Frank mentioned can't be fixed from the outside. You or the developers who use phase listens without thinking about the design view are the ones to fix this. Frank provided you with the solution for this.
    However, we don't know if you use any self written phase listener. If you don't do this you have another problem. I do see some of your symptoms but can't reproduce them at the moment. As long as we can't reproduce the problem somehow it's difficult to to get a solution.
    My advise is to keep your eyes open (add I do) and whenever you can reproduce this behaviour come back and tell us about it. It's hard or impossible to give the 'best' settings for Jdev.conf as they depend on other factors e.g. operating system, memory, other applications running at the same time and many more.
    Personally I don't change the parameters as long as I can't put the problems to low memory (which I can't at the moment).
    Timo

  • Problem while designing an RPD

    Hi Experts,
    I have a problem while designing a chat.
    Basically I have a pivot table with X axis as calendar week ( 9 weekend dates) and Y axis as value a A
    Value of A in Y Axis
    X axis as : 2/6/2010, 1/30/2010, 1/23/2010, 1/16/2010, 1/9/2010, 1/2/2010, 12/26/2009
    Now my customer wants percentage value of
    1. Current week verses last week i.e value of 2/6/2010 with 1/30/2010
    2. Current week verses last month 1st week.2/6/2010 with 1/2/2010
    It will be great if someone can give me an idea how to design this ( might be in RPD/Answers/Chat/Pivot table)
    Someone suggested me
    It will be easy to do at RPD. YOu have to create metrics based using time series functions. Use Ago() function and calculate WeekAgo and Month Ago metrics. "
    But how? Could you please explain me in detail?
    I appreciate all your help
    Regards
    Jan

    There is a solution in answers, but not bullet proof,. But give a shot if you like it
    assuming you have date column, metric column( like quantity sold) in your report,.
    1. Add metric column to the report again and change the column formula to following and check this table view. Which gives you prior week value in every row.
    msum(Sales."Quantity Sold",2)-Sales."Quantity Sold"
    2. then add metric column again to report, change the folmula like following
    ((msum(Sales."Quantity Sold",2)-Sales."Quantity Sold" )* 100) / Sales."Quantity Sold"
    make you are closing braces correctly. above formula give you % change from last week to this week. Then use this new column in chart to show values.
    You can try same logic for Month Ago week value. but you need to change Msum function to get 4 weeks before value.
    liek this.... msum(Sales."Quantity Sold",5)-msum(Sales."Quantity Sold",4) will give 4 rows back value.
    for all this you report is sorted by date.

  • Problems in designing Gantt Charts through Web Dynpros

    Dear friends,
    We are having a situation in which we need to display the series of production orders in shop floor in a gantt chart having a specific start & end date and time.
    To implement this scenario, we are using Gantt Chart tool available in Web dynpro. In the gantt chart tool we are passing an XML file edited as per data to display production orders starting and ending at particular date and time.
    Now we are facing following problems to design this case.
    1. We are currently using type repository <TypeRepository href="apps/gantt/cprojects/TypeRepository.xml" version="1.0"> as a base type repository to define our XML file. This type repository we found in one of Gantt chart test examples. We believe if we are able to view this file we can know what types are available and how can we use their elements and attributes to define graph in XML file. Please help us how can we view this type repository.
    2. Currently we are viewing scale on Gantt chart only on date base. Can we view the scale at time base too? If yes, how?
    3. Currently we are manually editing our XML file to add up data that we want to display in our gantt charts. We would like to know what is standard procedure to edit XML file in a program. Additionally if you can tell us the functional modules or class-methods to edit XML file in program, this would be very helpful.
    Your kind help would be highly appreciated.
    Best regards,
    Navin Guru

    About where to find file apps/gantt/cprojects/TypeRepository.xml.
    Maybe it's not the best way, but i had access to portal server files (access to /usr/sap directory on server where enterprise portal was installed). And i found it there by jnet search criteria.
    In my case it layed in the following place:
    \usr\sap\<SID>\J01\j2ee\cluster\apps\sap.com\tcwddispwda\servlet_jsp\webdynpro\resources\sap.com\tcwddispwda\root\global\activeComp\

  • Problems Installing Designer 6.0 over Oracle 8i (Linux SUSE 8.0)

    I have problems installing Designer 6.0 over Oracle 8i (Linux SUSE 8.0). When I try to create the repository the installation hang up. I try over Oracle 8i (WIndows 2000) and the problems remain.
    Please any body can help?
    Is it possible to install Designer 6i and generate forms 6.0 (I mean for using Developer 6.0 (NOT 6i))?
    Best regards,
    JAGC

    Marcel,
    I had the same problem. Oracle gives as an answer that Designer 6.0 is not supported against 8.1.7. In the specified package a statement is issued which is a problem for 8.1.7. I changed that package and now it works fine.
    Comment as below and replace with the delete statement, then it compiles fines.
    I don't know if any problem can occur after that, but a Migration from a 1.3.2 repository to 6i works fine through this repository. Hope this helps.
    Kind Regards
    Jan Boersma
    Email: [email protected]
    see here:
    -- Remove Reserved Names entry and comment
    -- delete from sdd_reserved_names
    -- where (rn_res_name, rn_type) in ((upper(view_name), 'VIEW')
    -- ,(upper(pack_name), 'PACKAGE')
    -- ,(upper(pack_name), 'PACKAGE BODY')
    -- ,(upper(app_view_name), 'VIEW BODY'));
    delete from sdd_reserved_names
    where ((rn_res_name = UPPER(view_name) AND rn_type = 'VIEW') OR
    (rn_res_name = UPPER(pack_name) AND rn_type = 'PACKAGE') OR
    (rn_res_name = UPPER(pack_name) AND rn_type = 'PACKAGE BODY') OR
    (rn_res_name = UPPER(app_view_name) AND rn_type = 'VIEW BODY'));
    null

Maybe you are looking for