Error in SQL results

Hi ,
I am executing below statement in SQLplus.
select 'feed', count(d.d) , count(d1.d)from
(select 1 d from dual) d,
(select 1 d from dual where 1=2) d1
The output should be like
Feed 1 0
However, it is
Feed 0 0
Could anyone please let me know why is it so?

equi join for matched data only
SQL> select 'feed', count(d.d) , count(d1.d) from(with
2 tab1 as(select 1 d from dual)
3 select * from tab1) d,
4 (with
5 tab1 as (select 1 d from dual where 1=2)
6 select * from tab1)d1
7 where d.d=d1.d;
'FEE COUNT(D.D) COUNT(D1.D)
feed 0 0
Yes,
You have to use the outer join for matched and unmatched data
SQL> select 'feed', count(d.d) , count(d1.d) from(with
2 tab1 as(select 1 d from dual)
3 select * from tab1) d,
4 (with
5 tab1 as (select 1 d from dual where 1=2)
6 select * from tab1)d1
7 where d.d=d1.d(+);
'FEE COUNT(D.D) COUNT(D1.D)
feed 1 0
SQL> select 'feed', count(d.d) , count(d1.d) from(with
2 tab1 as(select 1 d from dual)
3 select * from tab1) d,
4 (with
5 tab1 as (select 1 d from dual where 1=2)
6 select * from tab1)d1
7 where d.d(+)=d1.d;
'FEE COUNT(D.D) COUNT(D1.D)
feed 0 0

Similar Messages

  • Connect by - sql help : getting error ORA-01489: result of string concatena

    here is an sql query and I am trying to cook a decode but since there are many columns invloved when I am trying to run this I am getting the following error:
    ORA-01489: result of string concatenation is too long
    Any kind of help is appreciated, I need to get this going otherwise I am dead :(
    Regards
    Rahul
    SQL:
    select sys_connect_by_path(c.decode_prep,'-') decode_prep
    from (select 'DECODE(BIAPPS_11.'||substr(b.all_cols,instr(b.all_cols,',',1,a.rn)+1,instr(b.all_cols,',',1,a.rn+1)-instr(b.all_cols,',',1,a.rn)-1)||','||'RAHULKALRA.'||substr(b.all_cols,instr(b.all_cols,',',1,a.rn)+1,instr(b.all_cols,',',1,a.rn+1)-instr(b.all_cols,',',1,a.rn)-1)||',''1'',''0'')' decode_prep, rownum curr, rownum -1 prev
    from (select rownum rn
    from dual connect by rownum <=
    (select (length('ROW_WID,COST_CENTER_NUM,COST_CENTER_NAME,COST_CENTER_DESC,CONTROL_AREA_NUM,CONTROL_AREA_NAME,CATEGORY_CODE,CATEGORY_NAME,CATEGORY_DESC,MANAGER_NAME,CURRENCY_CODE,CURRENCY_NAME,LANGUAGE_CODE,LANGUAGE_NAME,ST_ADDRESS1,ST_ADDRESS2,POST_OFFICE_BOX,CITY_NAME,STATE_CODE,STATE_NAME,REGION_CODE,REGION_NAME,COUNTRY_CODE,COUNTRY_NAME,POSTAL_CODE,PHONE_NUM,FAX_NUM,CSCN_HIER1_CODE,CSCN_HIER1_NAME,CSCN_HIER2_CODE,CSCN_HIER2_NAME,CSCN_HIER3_CODE,CSCN_HIER3_NAME,CSCN_HIER4_CODE,CSCN_HIER4_NAME,CSCN_HIER5_CODE,CSCN_HIER5_NAME,CSCN_HIER6_CODE,CSCN_HIER6_NAME,ACTIVE_FLG,CREATED_BY_WID,CHANGED_BY_WID,CREATED_ON_DT,CHANGED_ON_DT,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,AUX3_CHANGED_ON_DT,AUX4_CHANGED_ON_DT,SRC_EFF_FROM_DT,SRC_EFF_TO_DT,EFFECTIVE_FROM_DT,EFFECTIVE_TO_DT,DELETE_FLG,CURRENT_FLG,W_INSERT_DT,W_UPDATE_DT,DATASOURCE_NUM_ID,ETL_PROC_WID,INTEGRATION_ID,SET_ID,TENANT_ID,X_CUSTOM')
    - length(replace('ROW_WID,COST_CENTER_NUM,COST_CENTER_NAME,COST_CENTER_DESC,CONTROL_AREA_NUM,CONTROL_AREA_NAME,CATEGORY_CODE,CATEGORY_NAME,CATEGORY_DESC,MANAGER_NAME,CURRENCY_CODE,CURRENCY_NAME,LANGUAGE_CODE,LANGUAGE_NAME,ST_ADDRESS1,ST_ADDRESS2,POST_OFFICE_BOX,CITY_NAME,STATE_CODE,STATE_NAME,REGION_CODE,REGION_NAME,COUNTRY_CODE,COUNTRY_NAME,POSTAL_CODE,PHONE_NUM,FAX_NUM,CSCN_HIER1_CODE,CSCN_HIER1_NAME,CSCN_HIER2_CODE,CSCN_HIER2_NAME,CSCN_HIER3_CODE,CSCN_HIER3_NAME,CSCN_HIER4_CODE,CSCN_HIER4_NAME,CSCN_HIER5_CODE,CSCN_HIER5_NAME,CSCN_HIER6_CODE,CSCN_HIER6_NAME,ACTIVE_FLG,CREATED_BY_WID,CHANGED_BY_WID,CREATED_ON_DT,CHANGED_ON_DT,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,AUX3_CHANGED_ON_DT,AUX4_CHANGED_ON_DT,SRC_EFF_FROM_DT,SRC_EFF_TO_DT,EFFECTIVE_FROM_DT,EFFECTIVE_TO_DT,DELETE_FLG,CURRENT_FLG,W_INSERT_DT,W_UPDATE_DT,DATASOURCE_NUM_ID,ETL_PROC_WID,INTEGRATION_ID,SET_ID,TENANT_ID,X_CUSTOM',',')))+1 total_cols
    from dual)) a, (select ','||'ROW_WID,COST_CENTER_NUM,COST_CENTER_NAME,COST_CENTER_DESC,CONTROL_AREA_NUM,CONTROL_AREA_NAME,CATEGORY_CODE,CATEGORY_NAME,CATEGORY_DESC,MANAGER_NAME,CURRENCY_CODE,CURRENCY_NAME,LANGUAGE_CODE,LANGUAGE_NAME,ST_ADDRESS1,ST_ADDRESS2,POST_OFFICE_BOX,CITY_NAME,STATE_CODE,STATE_NAME,REGION_CODE,REGION_NAME,COUNTRY_CODE,COUNTRY_NAME,POSTAL_CODE,PHONE_NUM,FAX_NUM,CSCN_HIER1_CODE,CSCN_HIER1_NAME,CSCN_HIER2_CODE,CSCN_HIER2_NAME,CSCN_HIER3_CODE,CSCN_HIER3_NAME,CSCN_HIER4_CODE,CSCN_HIER4_NAME,CSCN_HIER5_CODE,CSCN_HIER5_NAME,CSCN_HIER6_CODE,CSCN_HIER6_NAME,ACTIVE_FLG,CREATED_BY_WID,CHANGED_BY_WID,CREATED_ON_DT,CHANGED_ON_DT,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,AUX3_CHANGED_ON_DT,AUX4_CHANGED_ON_DT,SRC_EFF_FROM_DT,SRC_EFF_TO_DT,EFFECTIVE_FROM_DT,EFFECTIVE_TO_DT,DELETE_FLG,CURRENT_FLG,W_INSERT_DT,W_UPDATE_DT,DATASOURCE_NUM_ID,ETL_PROC_WID,INTEGRATION_ID,SET_ID,TENANT_ID,X_CUSTOM'||',' all_cols from dual) b) c
    start with curr = 1
    connect by prior curr = prev
    order by length(sys_connect_by_path(c.decode_prep,'-')) desc
    same as above sql only difference is here I am pulling the first record from the result set which above query returns :
    select ltrim(replace(decode_prep,'-','||'),'||') decode_prep
    from (select sys_connect_by_path(c.decode_prep,'-') decode_prep
    from (select 'DECODE(BIAPPS_11.'||substr(b.all_cols,instr(b.all_cols,',',1,a.rn)+1,instr(b.all_cols,',',1,a.rn+1)-instr(b.all_cols,',',1,a.rn)-1)||','||'RAHULKALRA.'||substr(b.all_cols,instr(b.all_cols,',',1,a.rn)+1,instr(b.all_cols,',',1,a.rn+1)-instr(b.all_cols,',',1,a.rn)-1)||',''1'',''0'')' decode_prep, rownum curr, rownum -1 prev
    from (select rownum rn
    from dual connect by rownum <=
    (select (length('ROW_WID,COST_CENTER_NUM,COST_CENTER_NAME,COST_CENTER_DESC,CONTROL_AREA_NUM,CONTROL_AREA_NAME,CATEGORY_CODE,CATEGORY_NAME,CATEGORY_DESC,MANAGER_NAME,CURRENCY_CODE,CURRENCY_NAME,LANGUAGE_CODE,LANGUAGE_NAME,ST_ADDRESS1,ST_ADDRESS2,POST_OFFICE_BOX,CITY_NAME,STATE_CODE,STATE_NAME,REGION_CODE,REGION_NAME,COUNTRY_CODE,COUNTRY_NAME,POSTAL_CODE,PHONE_NUM,FAX_NUM,CSCN_HIER1_CODE,CSCN_HIER1_NAME,CSCN_HIER2_CODE,CSCN_HIER2_NAME,CSCN_HIER3_CODE,CSCN_HIER3_NAME,CSCN_HIER4_CODE,CSCN_HIER4_NAME,CSCN_HIER5_CODE,CSCN_HIER5_NAME,CSCN_HIER6_CODE,CSCN_HIER6_NAME,ACTIVE_FLG,CREATED_BY_WID,CHANGED_BY_WID,CREATED_ON_DT,CHANGED_ON_DT,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,AUX3_CHANGED_ON_DT,AUX4_CHANGED_ON_DT,SRC_EFF_FROM_DT,SRC_EFF_TO_DT,EFFECTIVE_FROM_DT,EFFECTIVE_TO_DT,DELETE_FLG,CURRENT_FLG,W_INSERT_DT,W_UPDATE_DT,DATASOURCE_NUM_ID,ETL_PROC_WID,INTEGRATION_ID,SET_ID,TENANT_ID,X_CUSTOM')
    - length(replace('ROW_WID,COST_CENTER_NUM,COST_CENTER_NAME,COST_CENTER_DESC,CONTROL_AREA_NUM,CONTROL_AREA_NAME,CATEGORY_CODE,CATEGORY_NAME,CATEGORY_DESC,MANAGER_NAME,CURRENCY_CODE,CURRENCY_NAME,LANGUAGE_CODE,LANGUAGE_NAME,ST_ADDRESS1,ST_ADDRESS2,POST_OFFICE_BOX,CITY_NAME,STATE_CODE,STATE_NAME,REGION_CODE,REGION_NAME,COUNTRY_CODE,COUNTRY_NAME,POSTAL_CODE,PHONE_NUM,FAX_NUM,CSCN_HIER1_CODE,CSCN_HIER1_NAME,CSCN_HIER2_CODE,CSCN_HIER2_NAME,CSCN_HIER3_CODE,CSCN_HIER3_NAME,CSCN_HIER4_CODE,CSCN_HIER4_NAME,CSCN_HIER5_CODE,CSCN_HIER5_NAME,CSCN_HIER6_CODE,CSCN_HIER6_NAME,ACTIVE_FLG,CREATED_BY_WID,CHANGED_BY_WID,CREATED_ON_DT,CHANGED_ON_DT,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,AUX3_CHANGED_ON_DT,AUX4_CHANGED_ON_DT,SRC_EFF_FROM_DT,SRC_EFF_TO_DT,EFFECTIVE_FROM_DT,EFFECTIVE_TO_DT,DELETE_FLG,CURRENT_FLG,W_INSERT_DT,W_UPDATE_DT,DATASOURCE_NUM_ID,ETL_PROC_WID,INTEGRATION_ID,SET_ID,TENANT_ID,X_CUSTOM',',')))+1 total_cols
    from dual)) a, (select ','||'ROW_WID,COST_CENTER_NUM,COST_CENTER_NAME,COST_CENTER_DESC,CONTROL_AREA_NUM,CONTROL_AREA_NAME,CATEGORY_CODE,CATEGORY_NAME,CATEGORY_DESC,MANAGER_NAME,CURRENCY_CODE,CURRENCY_NAME,LANGUAGE_CODE,LANGUAGE_NAME,ST_ADDRESS1,ST_ADDRESS2,POST_OFFICE_BOX,CITY_NAME,STATE_CODE,STATE_NAME,REGION_CODE,REGION_NAME,COUNTRY_CODE,COUNTRY_NAME,POSTAL_CODE,PHONE_NUM,FAX_NUM,CSCN_HIER1_CODE,CSCN_HIER1_NAME,CSCN_HIER2_CODE,CSCN_HIER2_NAME,CSCN_HIER3_CODE,CSCN_HIER3_NAME,CSCN_HIER4_CODE,CSCN_HIER4_NAME,CSCN_HIER5_CODE,CSCN_HIER5_NAME,CSCN_HIER6_CODE,CSCN_HIER6_NAME,ACTIVE_FLG,CREATED_BY_WID,CHANGED_BY_WID,CREATED_ON_DT,CHANGED_ON_DT,AUX1_CHANGED_ON_DT,AUX2_CHANGED_ON_DT,AUX3_CHANGED_ON_DT,AUX4_CHANGED_ON_DT,SRC_EFF_FROM_DT,SRC_EFF_TO_DT,EFFECTIVE_FROM_DT,EFFECTIVE_TO_DT,DELETE_FLG,CURRENT_FLG,W_INSERT_DT,W_UPDATE_DT,DATASOURCE_NUM_ID,ETL_PROC_WID,INTEGRATION_ID,SET_ID,TENANT_ID,X_CUSTOM'||',' all_cols from dual) b) c
    start with curr = 1
    connect by prior curr = prev
    order by length(sys_connect_by_path(c.decode_prep,'-')) desc)
    where rownum = 1
    Edited by: Mac_Freak_Rahul on Nov 28, 2012 1:31 AM : in the first sql ')'
    removed after desc in the last line so now this query will run and throw an error.

    Clearly your error is because the string concatenation you are doing with sys_connect_by_path is exceeding the 4000 bytes permitted by SQL.
    In that case you need to concatenate your data into a CLOB datatype, for which you'll need a CLOB aggregation function...
    create or replace type clobagg_type as object
      text clob,
      static function ODCIAggregateInitialize(sctx in out clobagg_type) return number,
      member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number,
      member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number,
      member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number
    create or replace type body clobagg_type is
      static function ODCIAggregateInitialize(sctx in out clobagg_type) return number is
      begin
        sctx := clobagg_type(null) ;
        return ODCIConst.Success ;
      end;
      member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number is
      begin
        self.text := self.text || value ;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number is
      begin
        returnValue := self.text;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number is
      begin
        self.text := self.text || ctx2.text;
        return ODCIConst.Success;
      end;
    end;
    create or replace function clobagg(input clob) return clob
      deterministic
      parallel_enable
      aggregate using clobagg_type;
    SQL> select trim(',' from clobagg(ename||',')) as enames from emp;
    ENAMES
    SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,CLARK,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,MILLER
    SQL> ed
    Wrote file afiedt.buf
      1  with t as
      2    (select 'PFL' c1, 0 c2,110 c3 from dual union all
      3     select 'LHL', 0 ,111 from dual union all
      4     select 'PHL', 1, 111 from dual union all
      5     select 'CHL', 2, 111 from dual union all
      6     select 'DHL', 0, 112 from dual union all
      7     select 'VHL', 1, 112 from dual union all
      8     select 'CPHL', 0, 114 from dual union all
      9     select 'WDCL', 1, 114 from dual union all
    10     select 'AHL' ,2 ,114 from dual union all
    11     select 'NFDL', 3, 114 from dual)
    12  --
    13  -- end of test data
    14  --
    15  select trim(clobagg(c1||' ')) as c1, c3
    16  from (select * from t order by c3, c2)
    17  group by c3
    18* order by c3
    SQL> /
    C1                                     C3
    PFL                                   110
    LHL CHL PHL                           111
    DHL VHL                               112
    CPHL AHL NFDL WDCL                    114

  • Error #3115: SQL Error.', details:'no such table

    Hi,
    I'm creating my Adobe Air App using Flash CS5 Professional and facing exactly the following error.
    SQLError: 'Error #3115: SQL Error.', details:'no such table: 'categories'', operation:'execute', detailID:'2013'
    My SQLite Db has been created using Firefox extension - SQLite Manager. The db file is placed into the same folder as the .fla and .swf files. The db has three tables namely: categories, period and activity. I don't understand why I'm getting this error. I have even tried copy pasting other source code from AS 3.0 reference guide but same error every time.
    The code below is a modified version of example code in AS 3.0 reference documentation. Can you suggest how the above error can be fixed?
    /you can also reply to me directly at [email protected]
    /regards
    import flash.data.SQLConnection;
    import flash.data.SQLResult;
    import flash.data.SQLStatement;
    import flash.display.Sprite;
    import flash.events.SQLErrorEvent;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    var conn:SQLConnection;
    var insertCategory:SQLStatement;
    var dbFile:File;
    databaseConnect();
    function databaseConnect():void
    // define where to find the database file
    var appStorage:File = File.applicationStorageDirectory;
    dbFile = appStorage.resolvePath("MyBudgetCalc.db");
    // open the database connection
    conn = new SQLConnection();
    conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
    conn.addEventListener(SQLEvent.OPEN, openHandler);
    trace("dbFile.exists:"+ dbFile.exists);
    conn.openAsync(dbFile);
    // Called when the database is connected
    function openHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.OPEN, openHandler);
    // start a transaction
    //Object(this).inputfield.text = "openHandler called.. ";
    conn.addEventListener(SQLEvent.BEGIN, beginHandler);
    conn.begin();
    trace("exiting openHandler..");
    // Called when the transaction begins
    function beginHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.BEGIN, beginHandler);
    //trace("beginHandler - SQLEvent message: "+SQLEvent.message);
    Object(this).inputfield.text = "beginHandler called.. ";
    insertCategory = new SQLStatement();
    insertCategory.sqlConnection = conn;
    insertCategory.text = "INSERT INTO categories(id, name) VALUES (', Auto')";
    insertCategory.execute();
    insertCategory.addEventListener(SQLEvent.RESULT, insertCategoryHandler);
        insertCategory.addEventListener(SQLErrorEvent.ERROR, errorHandler);
    trace("exiting beginHandler..");
    // Called after the phone number record is inserted
    function insertCategoryHandler(event:SQLEvent):void
    insertCategory.removeEventListener(SQLEvent.RESULT, insertCategoryHandler);
    insertCategory.removeEventListener(SQLErrorEvent.ERROR, errorHandler);
    // No errors so far, so commit the transaction
    conn.addEventListener(SQLEvent.COMMIT, commitHandler);
    conn.commit();
    trace("exiting insertCategoryHandler after conn.commit()..");
    // Called after the transaction is committed
    function commitHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.COMMIT, commitHandler);
    trace("exiting commitHandler(): Transaction complete..");
    // Called whenever an error occurs
    function errorHandler(event:SQLErrorEvent):void
    trace("entering errorHandler()..");
    // If a transaction is happening, roll it back
    if (conn.inTransaction)
    conn.addEventListener(SQLEvent.ROLLBACK, rollbackHandler);
    conn.rollback();
    trace(event.error.message);
    trace(event.error.details);
    trace("exiting errorHandler()..");
    // Called when the transaction is rolled back
    function rollbackHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.ROLLBACK, rollbackHandler);

    Can you try creating the table using the AIR ActionScript APIs? It is possible the SQLLite Manager program that you are using is creating a database that isn't compatible with AIR.

  • Error: java.sql.SQLException; must be caught or declared to be thrown.

    in a servlet, I have a class like:
    class mydb
    public static Connection conn;
    public static void init() throws SQLException
    // Load the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection ("jdbc:oracle:oci8:@baby", "scott", "tiger");
    public static String getValue() throws SQLException
    String curValue="";
    // Create a Statement
    Statement stmt = conn.createStatement ();
    // Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
    // Iterate through the result and print the employee names
    if (rset.next ())
    curValue = rset.getString (1);
    // Close the RseultSet
    rset.close();
    // Close the Statement
    stmt.close();
    return(curValue);
    public static void destroy() throws SQLException
    // Close the connection
    conn.close();
    but when it is called, errors "java.sql.SQLException; must be caught or declared to be thrown." encountered, how to solve this problem? please help.

    This is part of the Java language.
    If a method throws an exception, then
    it is telling you that the exception is
    something that you should be aware of.
    If you call a method which throws this exception, then the method must either catch this exception, or you may decide that this exception should be caught by the calling method.
    So, your choices are:
    1. Wrap the method call in a try{...} catch block
    -or-
    2. Change the (calling) method's signature to reflect the fact that this method can cause this exception to be thrown (add a 'throws SQLException' ) at end of signature.
    -John
    null

  • Using a Sql Result in Default Value of Dashboard Prompt

    Hi,
    I Create a Dashboard Prompt, this have two dates, the initial and the last for a period to filter. I need to set the default value in the fist and last date of the previous month, for example, if today is 20th of november the default value of initial date has been 1th of October and the last date has been 31th of october.
    I used in default the option 'SQL Results' and use the next sentences:
    SELECT TRUNC(add_months(sysdate, -1), 'MM') FROM dual;
    SELECT TRUNC(last_day(add_months(sysdate, -1))) from dual;
    But when I try to use the dashboard prompt the result is:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <(>: Syntax error [nQSError: 26012] . (HY000)
    SQL Issued: SELECT TRUNC(add_months(sysdate,-1),'MM') FROM dual
    When I try to use only select sysdate from dual; the result is:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27004] Unresolved table: "dual". (HY000)
    Thanks for your help.

    Thanks for your help. Finally I solve this issue of
    this form:
    1. I Create a Initialization Block with the next
    sentences:
    SELECT TRUNC(add_months(sysdate, -1), 'MM')
    INITIAL_DATE ,TRUNC(last_day(add_months(sysdate,
    -1))) END_DATE, To_char(TRUNC(add_months(sysdate,
    -1), 'MM'), 'YYYYMM') PERIOD FROM dual;
    2. Then I Create three Repository Variables and
    assign the Initialization Block to this
    3. In the Dashboard Prompt I use the "Server
    Variable" Option in the default and call the three
    variables.
    Thanks again
    EdwinHi: How u access server variable with two fields of date. Actually, I am doing the same work. But I can not do this work. Because this is ok when the date is greater than or less than. When i use between, in default server variable button did not show any text area for reoository variable. I also made initailization block with 2 fields.
    My Task is, I have to initialize the one date coloumn. From Date: and To Date. Pluzz help me in section
    Ali Haroon Nawaz

  • Error: java.sql.SQLException: No suitable driver

    Hi,
    Here is the source file in Java :
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class FruitTest3 extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    String url = "jdbc:oracle:thin(or kprb ):sys/jameson@(DESCRIPTION=(ADDRESS_LIST =(ADDRESS =(COMMUNITY =
    tcp.insee.fr)(PROTOCOL = TCP)(Host = 10.20.108.3)(Port = 1521)))(CONNECT_DATA = (SID = ORA817)))";
    String table;
    try {
    String query =
    "SELECT * " +
    " FROM sys.sales";
    Connection connection = DriverManager.getConnection(url);
    DBResults results =
    DatabaseUtilities.getQueryResults(connection,
    query, false);
    table = results.toHTMLTable("#FFAD00");
    } catch(Exception e) {
    table = "Error: " + e;
    response.setContentType("text/html");
    // Prevent the browser from caching the response. See
    // Section 7.2 of Core Servlets and JSP for details.
    response.setHeader("Pragma", "no-cache"); // HTTP 1.0
    response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1
    PrintWriter out = response.getWriter();
    String title = "Connection Pool Test";
    out.println("<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<CENTER>\n" +
    table + "\n" +
    "</CENTER>\n</BODY></HTML>");
    Irceive the error message : Error: java.sql.SQLException: No suitable driver
    Thanks in advance.

    hi nick..
    im having thiis particular problem too. part of my codes look like this
    try
                   Class.forName("org.gjt.mm.mysql.Driver");
                   connection = DriverManager.getConnection("jdbc:mysql//localhost/mmovies:/");
                   statement = connection.createStatement();
                   rs = statement.executeQuery("select * from timetable");
                   String result = "";
                   while(rs.next())
                        //String result = rs.getString(2);
                        String moviename = rs.getString(1);
                        result += moviename + ";";
                        System.out.println(result);
    i have specified the 'driver'.
    i have also places a 'gjt' folder in the same place as all my server codes. Please advice.
    Thanks
    -faridz

  • Error Upgrading SQL 2012 SP1 to SP2

    Get this error when trying to install KB2958429. 
    Action required:
    Use the following information to resolve the error, and then try the setup process again.
    Feature failure reason:
    An error occurred during the setup process of the feature.
    Error details:
    § Error installing SQL Server Database Engine Services Instance Features
    The User Data directory in the registry is not valid. Verify DefaultData key under the instance hive points to a valid directory.
    Error code: 0x851A0043
    Visit  to get help on troubleshooting.
    Here is the summary.
    Overall summary:
      Final result:                  The patch installer has failed to update the following instance: MSSQLSERVER. To determine the reason for failure, review the log files.
      Exit code (Decimal):           -2061893565
      Start time:                    2014-09-10 23:27:40
      End time:                      2014-09-10 23:30:44
      Requested action:              Patch
    Instance MSSQLSERVER overall summary:
      Final result:                  The patch installer has failed to update the shared features. To determine the reason for failure, review the log files.
      Exit code (Decimal):           -2061893565
      Start time:                    2014-09-10 23:29:38
      End time:                      2014-09-10 23:30:41
      Requested action:              Patch
    Machine Properties:
      Machine name:                  ANTXSQL5
      Machine processor count:       2
      OS version:                    Future Windows Version
      OS service pack:              
      OS region:                     United States
      OS language:                   English (United States)
      OS architecture:               x64
      Process architecture:          64 Bit
      OS clustered:                  No
    Product features discovered:
      Product              Instance             Instance ID                   
    Feature                                  Language            
    Edition              Version         Clustered  Configured
      SQL Server 2012      MSSQLSERVER          MSSQL11.MSSQLSERVER            Database Engine Services                
    1033                 Standard Edition     11.1.3128.0     No         Yes      
      SQL Server 2012                                                         
    Management Tools - Basic                 1033                 Standard Edition    
    11.2.5058.0     No         Yes      
      SQL Server 2012                                                         
    Management Tools - Complete              1033                 Standard Edition     11.2.5058.0    
    No         Yes      
      SQL Server 2012                                                         
    Client Tools SDK                         1033                
    Standard Edition     11.2.5058.0     No         Yes      
    Package properties:
      Description:                   Microsoft SQL Server 2012
      ProductName:                   SQL Server 2012
      Type:                          RTM
      Version:                       11
      SPLevel:                       2
      KBArticle:                     KB2958429
      KBArticleHyperlink:           
      PatchType:                     SP
      AssociatedHotfixBuild:         0
      Platform:                      x64
      PatchLevel:                    11.2.5058.0
      ProductVersion:                11.0.2100.60
      GDRReservedRange:              11.0.5300.0:11.0.5499.0
      PackageName:                   SQLServer2012-KB2958429-x64.exe
      Installation location:         c:\eed85e43821e2e4fc7fd04f2f02561\x64\setup\
    Updated product edition:
      Instance             Edition            
      MSSQLSERVER          Standard           
    User Input Settings:
      ACTION:                        Patch
      ALLINSTANCES:                  false
      CLUSTERPASSIVE:                false
      CONFIGURATIONFILE:            
      ENU:                           true
      HELP:                          false
      IACCEPTSQLSERVERLICENSETERMS:  true
      INDICATEPROGRESS:              false
      INSTANCEID:                    <empty>
      INSTANCENAME:                  <empty>
      QUIET:                         false
      QUIETSIMPLE:                   false
      SQMREPORTING:                  false
      UIMODE:                        Normal
      X86:                           false
    Rules with failures:
    Global rules:
    There are no scenario-specific rules.
    Rules report file:               C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20140910_232739\SystemConfigurationCheck_Report.htm
    The SystemConfigurationCheck_Report is all ok.

    <?xml version="1.0" encoding="utf-8"?>
    <html>
      <head>
        <title>System Configuration Check Report for Microsoft SQL Server 2012 </title>
      </head>
      <body>
        <p STYLE="font-family: Verdana, Arial, sans-serif; font-size: 14pt;">
          <b>Microsoft SQL Server 2012  - System Configuration Check Report</b>
        </p>
        <p STYLE="font-family: Verdana, Arial, sans-serif; font-size: 10pt;">
          <b>Computer Name(s): </b>ANTXSQL5 <br /><b>Report Date/Time: </b>9/10/2014 11:28 PM<br /><b>Saved to Directory: </b><a href="C:\Program Files\Microsoft SQL Server\110\Setup
    Bootstrap\Log\20140910_232739\SystemConfigurationCheck_Report.htm">C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20140910_232739\SystemConfigurationCheck_Report.htm</a></p>
        <table border="1" cellpadding="7" cellspacing="0" STYLE="font-family: Verdana, Arial, sans-serif; font-size: 9pt;">
          <tr style="background-color:Silver">
            <th colspan="2" align="center">Rule Name</th>
            <th align="center">Rule Description</th>
            <th align="center">Result</th>
            <th align="center">Message/Corrective Action</th>
          </tr>
          <tr style="background-color:Aqua">
            <td colspan="5">
              <b>PatchGlobalRules:
                        SQL Server 2012 Setup configuration checks for rules group 'PatchGlobalRules'</b>
            </td>
          </tr>
          <tr valign="top">
            <td>
              <img src="resources\ProgressSkip.ico" />
            </td>
            <td>Engine_ResourceDLLUpdateRestartCheck</td>
            <td>Checks whether shared resource DLLs will be updated, causing restarts for clustered SQL Server instances active on this node.</td>
            <td>Not applicable</td>
            <td>This rule does not apply to your system configuration.</td>
          </tr>
          <tr valign="top" style="background-color:LightYellow">
            <td>
              <img src="resources\ProgressSuccess.ico" />
            </td>
            <td>AclPermissionsFacet</td>
            <td>Checks if the SQL Server registry keys are consistent.</td>
            <td>Passed</td>
            <td>SQL Server registry keys are consistent and can support SQL Server installation or upgrade.</td>
          </tr>
          <tr valign="top">
            <td>
              <img src="resources\ProgressSuccess.ico" />
            </td>
            <td>Cluster_IsLocalNodeGroupOwner</td>
            <td>Checks if the local computer is an owner of an online cluster group for a failover cluster instance that contains the SQL Server service, Analysis Services service or a generic service.</td>
            <td>Passed</td>
            <td>The local computer is not an owner of an online cluster group for a failover cluster instance that contains the SQL Server service, Analysis Services service or a generic service. The SQL Server instances
    do not need to be taken offline.</td>
          </tr>
          <tr valign="top" style="background-color:LightYellow">
            <td>
              <img src="resources\ProgressSuccess.ico" />
            </td>
            <td>Cluster_IsOnlineIfClustered</td>
            <td>Verifies that the computer is not clustered or that the computer is clustered and the cluster service is online.</td>
            <td>Passed</td>
            <td>The computer is either not clustered or the cluster is up and online.</td>
          </tr>
          <tr valign="top">
            <td>
              <img src="resources\ProgressSuccess.ico" />
            </td>
            <td>RebootRequiredCheck</td>
            <td>Checks if a pending computer restart is required. A pending restart can cause Setup to fail.</td>
            <td>Passed</td>
            <td>The computer does not require a restart.</td>
          </tr>
          <tr valign="top" style="background-color:LightYellow">
            <td>
              <img src="resources\ProgressSuccess.ico" />
            </td>
            <td>ThreadHasAdminPrivilegeCheck</td>
            <td>Checks whether the account running SQL Server Setup has administrator rights on the computer.</td>
            <td>Passed</td>
            <td>The account running SQL Server Setup has administator rights on the computer.</td>
          </tr>
          <tr valign="top">
            <td>
              <img src="resources\ProgressSuccess.ico" />
            </td>
            <td>WmiServiceStateCheck</td>
            <td>Checks whether the WMI service is started and running on the computer.</td>
            <td>Passed</td>
            <td>The Windows Management Instrumentation (WMI) service is running.</td>
          </tr>
        </table>
        <p STYLE="font-family: Verdana, Arial, sans-serif; font-size: 10pt;">
          <b>Rules Documentation: </b>
          <a href
          <br />
          <b>Community: </b>
          <a href
          <br />
          <b>Setup Help File: </b>
          <a href="
        </p>
      </body>
      <xml id="xmlDataIsland">
        <RunRuleResults>
      <Header reportDate="9/10/2014" reportTime="11:28 PM" savedToDirectory="C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\Log\20140910_232739\SystemConfigurationCheck_Report.htm">
        <Machines>
          <Machine value="ANTXSQL5" />
        </Machines>
      </Header>
      <group groupName="PatchGlobalRules" groupDescription="SQL Server 2012 Setup configuration checks for rules group 'PatchGlobalRules'">
        <RunRuleResult ruleName="ThreadHasAdminPrivilegeCheck" machineName="ANTXSQL5" description="Checks whether the account running SQL Server Setup has administrator rights on the computer." result="Passed"
    message="The account running SQL Server Setup has administator rights on the computer." imagePath="resources\ProgressSuccess.ico" />
        <RunRuleResult ruleName="RebootRequiredCheck" machineName="ANTXSQL5" description="Checks if a pending computer restart is required. A pending restart can cause Setup to fail." result="Passed" message="The
    computer does not require a restart." imagePath="resources\ProgressSuccess.ico" />
        <RunRuleResult ruleName="WmiServiceStateCheck" machineName="ANTXSQL5" description="Checks whether the WMI service is started and running on the computer." result="Passed" message="The Windows
    Management Instrumentation (WMI) service is running." imagePath="resources\ProgressSuccess.ico" />
        <RunRuleResult ruleName="AclPermissionsFacet" machineName="ANTXSQL5" description="Checks if the SQL Server registry keys are consistent." result="Passed" message="SQL Server registry keys are
    consistent and can support SQL Server installation or upgrade." imagePath="resources\ProgressSuccess.ico" />
        <RunRuleResult ruleName="Cluster_IsOnlineIfClustered" machineName="ANTXSQL5" description="Verifies that the computer is not clustered or that the computer is clustered and the cluster service is online." result="Passed"
    message="The computer is either not clustered or the cluster is up and online." imagePath="resources\ProgressSuccess.ico" />
        <RunRuleResult ruleName="Cluster_IsLocalNodeGroupOwner" machineName="ANTXSQL5" description="Checks if the local computer is an owner of an online cluster group for a failover cluster instance that contains the
    SQL Server service, Analysis Services service or a generic service." result="Passed" message="The local computer is not an owner of an online cluster group for a failover cluster instance that contains the SQL Server service, Analysis Services
    service or a generic service. The SQL Server instances do not need to be taken offline." imagePath="resources\ProgressSuccess.ico" />
        <RunRuleResult ruleName="Engine_ResourceDLLUpdateRestartCheck" machineName="ANTXSQL5" description="Checks whether shared resource DLLs will be updated, causing restarts for clustered SQL Server instances active
    on this node." result="Not applicable" message="This rule does not apply to your system configuration." imagePath="resources\ProgressSkip.ico" />
      </group>
      <Resources rulesDocumentation="
    </RunRuleResults>
      </xml>
    </html>

  • SQLError: 'Error #3115: SQL Error.', details:'no such table: 'contact'', operation:'execute', detail

    hi
    just create database with SQLite Database Browser 2.0 b1 after creating the data base when i tried connect it in flash cs4-with air 1.1 its showing me error
    SQLError: 'Error #3115: SQL Error.', details:'no such table: 'contact'', operation:'execute', detailID:'2013' i tried to found every where but did not get the solution of this
    my code is here
    import flash.filesystem.File;
    import flash.data.*;
    import flash.data.SQLConnection;
    import flash.data.SQLStatement;
    import flash.data.SQLConnection;
    var dbFile:File=File.applicationStorageDirectory.resol  vePath("mydb.db");
    var sqlConn:SQLConnection = new SQLConnection();
    var sqlState:SQLStatement = new SQLStatement();
    sqlConn.open(dbFile);
    sqlState.sqlConnection = sqlConn;
    trace(sqlConn.connected+"current status "); // its show "true" here
    sqlState.text = "SELECT name FROM contact";
    sqlState.execute();
    var resultArray:Array = sqlState.getResult().data;
    thanks in advance

    Hi,
    I'm creating my Adobe Air App using Flash CS5 Professional and facing exactly the same error.
    SQLError: 'Error #3115: SQL Error.', details:'no such table: 'categories'', operation:'execute', detailID:'2013'
    My SQLite Db has been created using Firefox extension - SQLite Manager. The db file is placed into the same folder as the .fla and .swf files. The db has three tables namely: categories, period and activity. I don't understand why I'm getting this error. I have even tried copy pasting other source code from AS 3.0 reference guide but same error every time.
    The code below is a modified version of example code in AS 3.0 reference documentation. Can you suggest how the above error can be fixed?
    /you can also reply to me directly at [email protected]
    /regards
    import flash.data.SQLConnection;
    import flash.data.SQLResult;
    import flash.data.SQLStatement;
    import flash.display.Sprite;
    import flash.events.SQLErrorEvent;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    var conn:SQLConnection;
    var insertCategory:SQLStatement;
    var dbFile:File;
    databaseConnect();
    function databaseConnect():void
    // define where to find the database file
    var appStorage:File = File.applicationStorageDirectory;
    dbFile = appStorage.resolvePath("MyBudgetCalc.db");
    // open the database connection
    conn = new SQLConnection();
    conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);
    conn.addEventListener(SQLEvent.OPEN, openHandler);
    trace("dbFile.exists:"+ dbFile.exists);
    conn.openAsync(dbFile);
    // Called when the database is connected
    function openHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.OPEN, openHandler);
    // start a transaction
    //Object(this).inputfield.text = "openHandler called.. ";
    conn.addEventListener(SQLEvent.BEGIN, beginHandler);
    conn.begin();
    trace("exiting openHandler..");
    // Called when the transaction begins
    function beginHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.BEGIN, beginHandler);
    //trace("beginHandler - SQLEvent message: "+SQLEvent.message);
    Object(this).inputfield.text = "beginHandler called.. ";
    insertCategory = new SQLStatement();
    insertCategory.sqlConnection = conn;
    insertCategory.text = "INSERT INTO categories(id, name) VALUES (', Auto')";
    insertCategory.execute();
    insertCategory.addEventListener(SQLEvent.RESULT, insertCategoryHandler);
        insertCategory.addEventListener(SQLErrorEvent.ERROR, errorHandler);
    trace("exiting beginHandler..");
    // Called after the phone number record is inserted
    function insertCategoryHandler(event:SQLEvent):void
    insertCategory.removeEventListener(SQLEvent.RESULT, insertCategoryHandler);
    insertCategory.removeEventListener(SQLErrorEvent.ERROR, errorHandler);
    // No errors so far, so commit the transaction
    conn.addEventListener(SQLEvent.COMMIT, commitHandler);
    conn.commit();
    trace("exiting insertCategoryHandler after conn.commit()..");
    // Called after the transaction is committed
    function commitHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.COMMIT, commitHandler);
    trace("exiting commitHandler(): Transaction complete..");
    // Called whenever an error occurs
    function errorHandler(event:SQLErrorEvent):void
    trace("entering errorHandler()..");
    // If a transaction is happening, roll it back
    if (conn.inTransaction)
    conn.addEventListener(SQLEvent.ROLLBACK, rollbackHandler);
    conn.rollback();
    trace(event.error.message);
    trace(event.error.details);
    trace("exiting errorHandler()..");
    // Called when the transaction is rolled back
    function rollbackHandler(event:SQLEvent):void
    conn.removeEventListener(SQLEvent.ROLLBACK, rollbackHandler);

  • Dropdown menue or selectlist from fetched SQL results

    Hello i try to build a selectlist or a dropdown menue from fetched Sql results i tryed many ways to realise this but nothing works is anybody here knowing how to do this?
    heres my code example but it isnt work:
    <?php
    if ($conn=OCILogon($HTTP_POST_VARS['user'], $HTTP_POST_VARS['pass'], $HTTP_POST_VARS['dienst'])) {
    echo "Successfully connected to Oracle.\n";
    OCILogoff($c);
    } else {
    $err = OCIError();
    echo "Oracle Connect Error " . $err[text];
    //fetch
    $stmt = OCIParse($conn,"select Table_Name from User_Tables");
    OCIExecute($stmt);
         while (OCIFetch($stmt))
         print "<select name="Rang">";     
         print "<option>$id</option>\n";
         print "</select>";
    OCILogoff($conn);
    ?>
    Message was edited by:
    LOD
    Message was edited by:
    LOD

    There's a basic error in your sample code. You query for table_name from user_tables, which basically just lists the tables that exist in your schema. Since you're using 'id' further on, I suspect your query would look something like 'select id from users'.
         while (OCIFetch($stmt))
         print "<select name="Rang">";     
         print "<option>$id</option>\n";
         print "</select>";
    }This won't work for 2 major reasons.
    1. the $id variable is not set to anything. Note that OCIFetch does not extract variables. You can retrieve them using OCIResult($stmt, 'id'). I myself prefer to use OCIFetchInto as it is much easier to use and gives code that is better readable:
    while (ocifetchinto($stmt, $record))
      print $record['ID'];
    }2. You've put the <select></select> code in your loop. I assume that you only want to loop options, so the <select></select> should be moved to outside the loop.

  • Migration -actions=mkconn returns always Error: java.sql.SQLException: Inva

    Hi
    I'm migrate from MS SQL 2005 to Oracle 11g using SQL Developer V3.0.04
    Trying to use the batch file migration.bat. Found the documentation with migration -help=guide
    Every action I start results in the SQLException below:
    D:\oracle\product\sqldeveloper_3.0.04\sqldeveloper\sqldeveloper\bin>migration -actions=mkconn -connDetails=super_oracle:oracle:system/manager@xxxxxxxx:1521/mps
    Error: java.sql.SQLException: Invalid connection information specified.
    Verify the URL format for the specified driver.
    HELP:
    Running the command with -output=d:\migr creates a logfile with the same error message.
    If I run the login credential with sqlplus system/manager@xxxxxxxx:1521/mps, I manage to connect to the database.
    I assume the help is wrong specifying host:port:sid. I think host:port/sid is correct, at least with sqlplus this works
    If I do a migration with sqldeveloper it works too.
    I'm lost at this point. Any advise is appreciated.
    Thanks a lot
    Beat

    Hi
    In SQL Developer, did you already create a connection to the Oracle database storing the Migration Repository?
    Yes
    I do:
    migration -action=init -conn=MyRepositoryDB
    HELP:
    Syntax:
    Migration -help|-h=<actions> to get help on one or more actions.
    where
    +<actions> could be one or more (comma separated list) actions or guide+
    guide provides a walk through of a typical migration
    Examples:
    Migration -help=capture
    Migration -h=capture,convert
    Migration -h=guide
    The message: init completed successfully is missing. Only HELP:.......... is showing up
    The same if I do now:
    D:\oracle\product\sqldeveloper_3.0.04\sqldeveloper\sqldeveloper\bin>migration -action=lsconn
    HELP:
    Syntax:
    Migration -help|-h=<actions> to get help on one or more actions.
    where
    +<actions> could be one or more (comma separated list) actions or guide+
    guide provides a walk through of a typical migration
    Examples:
    Migration -help=capture
    Migration -h=capture,convert
    Migration -h=guide
    Valid actions:
    capture, convert, datamove, delcaptured, delconn, delconverted, driver, generate, guide, idmap, info, init, ls
    m, runsql, scan and translate
    D:\oracle\product\sqldeveloper_3.0.04\sqldeveloper\sqldeveloper\bin>
    Only HELP:.......... is showing up

  • Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]

    I am having a problem inserting/updateing date field of MS Access database with JDBC. I have tried several solutions. Serveral Field formats in the db and several methods with java. I will post my most recent attempt. I can read from the database I just can't write the date to the db, though I can write to any other field with a different datatype.
    Please don't bash me for using MS Access, it is my only option.
    Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row
    if (rs != null){
    while ( rs.next() ) {
    Date tDate;
              //Timestamp tDate;
              //String tDate;
    tDate = rs.getDate("Week");
              //tDate = rs.getTimestamp("Week");
              //tDate = rs.getString("Week");
              java.sql.Date sqlDate = new java.sql.Date( Date.getTime() );
              //java.sql.Timestamp sqlDate = new java.sql.Timestamp( tDate.getTime()
    System.out.println("Date: " + tDate );
    //System.out.println("Date: " + sqlDate );
    //System.out.println("Date: " + rs.getDate ("Date") );
    // 2004-03-24 00:00:00.0 this is Timestamp output
         Cpu.moveToInsertRow();
    Cpu.updateDate("Date_Col",sqlDate );
         //Cpu.updateDate("Date_Col",tDate );
         //Cpu.updateTimestamp("Date_Col", sqlDate);
         Cpu.insertRow();
    Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row
    Please help..........

    I can insert a new row and add all the fields (includeing date (as string)), but I have to use SQL statements. I cannot get the result set functions to work.
    I can retieve a rs just fine and print all the contents of the rs.
    My problem is with rs.updateRow();
    my code is below,
    public class Cpu_Load_Total_Cpu{
    public static void main(String[] args){
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String filename = "C:/dev/SHC/Cpu_Java/CFS_Health.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database+= filename.trim() + ";DriverID=22;READONLY=false}";
    Connection con = DriverManager.getConnection( database ,"","");
    Statement stmt = con.createStatement(
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
         ResultSet Cpu = stmt.executeQuery("SELECT * FROM Cpu");
    if (Cpu != null){
         while ( Cpu.next() ) {
                   int tUsr, tSys, tWio, tIdle, tTotal_Cpu;
                   tUsr = Cpu.getInt("Usr");
                   tSys = Cpu.getInt("Sys");
                   tWio = Cpu.getInt("Wio");
                   tIdle = 100 - (tSys + tUsr + tWio);
                   tTotal_Cpu = tSys + tUsr + tWio;
                   Cpu.updateLong(8, tTotal_Cpu);
    //or Cpu.updateLong("Total_Cpu", tTotal_Cpu);
    // I get the same error as the post above
    // when I include the Cpu.updateRow(); call
                   Cpu.updateRow();
    // when excluded everything else runs fine, but
    // the db is not updated
    // as stated, everything prints to the screen or pipe when
    // updateRow is excluded
                   System.out.println("Usr: " + tUsr );
                   System.out.println("Sys: " + tSys );
                   System.out.println("Wio: " + tWio);
                   System.out.println("Total_Cpu: " + tTotal_Cpu);
                        con.commit();
                   stmt.close();
                   con.close();
    catch (Exception e) {
    System.out.println("Error: " + e);
    }

  • Using Presentation variables in Prompt Default using SQL Results.

    I have set a presentation variable in a prompt(say 1st prompt). In the 2nd prompt, using default option, when I try to reference this variable in SQL Results, I get this error.
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <@>: Syntax error [nQSError: 26012] . (HY000)
    The syntax used for SQL is:
    SELECT <tab>.<col1> FROM <subject area> WHERE <tab>.<col2> = @{variables.myvar}
    Note: However the same SQL works fine in SHOW option.
    Thanks in advance..
    Edited by: user457687 on Feb 27, 2009 3:13 PM
    Edited by: user457687 on Feb 27, 2009 4:49 PM

    - OK. In the second prompt, instead of setting Default to SQL Results, set it to Specific Value.
    - Then insert '{pres_var}' in the window. I got it to work this way.
    - It supplied the PV as the default in the second prompt after hitting "Go" on the first prompt.
    Hi, thanks for your suggestion but I don't need to have the value of the presentation variable itself as the prompt default. The variable is a filter for a specific SQL clause and the default is the result of this SQL.
    Cheers
    DrPlexi

  • Column Filter Prompt with SQL Results failing

    I am trying to restrict a prompt's values so that that the column which contains dates are only valid dates in our production load history. Usually these are dates prior to the current date. I have tried several queries in SQL results, but I keep getting an error. Anyone know what I'm doing wrong here?
    Select "IBS_LOAD_DASHBOARD"."DATE_OF_DATA" from "IBS Stats". "IBS_LOAD_DASHBOARD" where "IBS_LOAD_DASHBOARD"."DATE_OF_DATA" <= "LAST_IBS_LOAD"."Last Data Load" ( LAST_IBS_LOAD"."Last Data Load" is the last valid load date)
    or
    Select "IBS_LOAD_DASHBOARD"."DATE_OF_DATA" from "IBS Stats". "IBS_LOAD_DASHBOARD" where "IBS_LOAD_DASHBOARD"."DATE_OF_DATA" < CURRENT DATE
    On a separate note, when I get the prompt working, only the prompt shows in the initial results. Is there a way to get both the prompt and the full results on the dashboard?
    Edited by: BISP on Jun 6, 2012 3:10 PM

    I created another request which comes from a view with our last prod load date. I then linked to this date in the filter

  • Using Sql Result and Limit Value in Prompt OBIEE 11.1.1.5

    Dear Gurus,
    I have prompt hierarchy like this:
    Year
    Quarter
    Month
    Which are using limit value (Quarter depend on Year, Month depend on Quarter), but I have issue because appear null also in those prompt
    I have checked my database, view, repository there are not null.
    My questions is, how to remove null in prompt when sql result can't use together with limit value, I don't know how to remove it using column filter.
    NB:I already using presentation variable in sql result in order to remove null and using constraint, but it show nothing in prompt view unless we press apply button.
    So I don't use this
    Please help, kindly appreciated
    JOE
    Edited by: JoeSSI on Mar 27, 2012 2:03 AM

    Hi,
    Can you edit your prompt here you can find show option then select SQL Result please modify statement like below.
    SELECT your column name FROM subject area where your column name is not null
    Go--> Edit your prompt--> Show--> Select Sql result---> change statement like above.
    Second way.
    Go to physical layer then double click your column name here you can find *"nullable"* option please check that.
    Go--> Physical Layer--> Extract table --> select your column name-->double click your column name--> here you can find option like Nullable please check it.
    Award points it is useful.
    Thanks,
    Satya

  • How can I use a Lookup task to lookup from my SQL Result set and have a join

    So in my Control Flow, I have an Execute SQL Task which gets my Table result set. I then have a Foreach Loop Container that iterates through the result set and a Data Flow. The first task in the Data Flow is an OLE DB Source SQL Command that retrieves data
    columns associated with my result set. I then do a Derived Column so I can SUBSTRING from one of my data columns and now I want to perform a Lookup to my Application Database.
    How do I code my Lookup task to utilize my SQL Result set variable and match on it? I cannot use the GUI for the Lookup task as my Lookup has to have some JOINS in it.
    Thanks for your review and am hopeful for a reply.

    Can you expand on that? I'm sorry but I am new and a novice to the SSIS world and I want to do this as best I can and as efficiently as I can. Are you saying that Rajen's way suggested above is the way to go?
    A little background....external data from a 3rd party client. I'v staged that external data to a SQL Server staging table. I have to try and match that data up to our database using SSN, DOB, and Gender...and if I can't match that way then I have to try
    and match by Name. I need to make sure that there is only one and only one account for that match. If I cannot match and match one and only one, then I'll create rows on a DataAnomaly Table. If I do match, then I have to check and make sure that there is only
    one and only one Member span for that match. Similarly handle the data anomaly and then check and make sure there is a "Diabetes" claim and similarly handle the DataAnomaly accordingly.
    That's where I'm at. Sooooo are you saying to use Rajen's suggestion? I don't think I can do that because I need multiple SQL tasks and I cannot connect multiple OLE DB Source tasks.
    Any help and suggestions are greatly appreciated.
    Thanks.

Maybe you are looking for