Preventing column to be in insert query when value is null

I'm running DB and have a column defined as GENERATED ALWAYS.
What this means is that I can't use insert into table(col) values (null) because DB2 does not want the column to be part of the insert query at all.
Is there a way to prevent toplink from generating the column when its null?

Hi jsutherl,
If I set setIsReadOnly(true) in my session customzier and specify insertable and updateable as false, I get the followine error:
Exception [TOPLINK-46] (Oracle TopLink Essentials - 2.0.1 (Build b04-fcs (04/11/2008))): oracle.toplink.essentials.exceptions.DescriptorException
Exception Description: There should be one non-read-only mapping defined for the primary key field [TBL.PERSON.ID].
Descriptor: RelationalDescriptor(com.x.entity.Person--> [DatabaseTable(TBL.PERSON)])
I'm guessing this is because ID is a primary key and its forcing me to have a non-read-only mapping.
But the dillemma is that if I specify a non-read-only mapping than any insert on the table results in Toplink inserting the Java type null for the column which results in the following exception:
Internal Exception: com.ibm.db2.jcc.b.SQLException: A value cannot be specified for column "ID" which is defined as GENERATED ALWAYS.
This is because the field is defined as an IDENTITY in DB2.
Any thoughts?

Similar Messages

  • C# : Get Column name for an Insert Query from The Selected GridView Row.

    Hi Guys, I am trying to insert data in an SQL table by executing an Insert Query. 
    The problem is that I need to get the column name from a cell in the selected gridview Row.
    Here's the snippet:
    SqlCommand cmd30 = new SqlCommand("insert into mytable ( '"+GridView7.SelectedRow.Cells[0].Text+"' , r_id) values ('"+ GridView7.SelectedRow.Cells[1].Text +"', '"+TextBox1.Text+"')",con30);
            cmd30.ExecuteNonQuery();
    **r_id is not a Primary Key.
    The Error is get is:
    Incorrect syntax near 'r_id'.
    Any Help will be appreciated.
    Thanks,
    Shaleen
    TheHexLord

    Hi TheShaleen,
    Like your title mentioned.GridView control is a web class.This forum is to discuss problems of C# development.  Your question is not related to the topic of this forum.
    You'll need to post it in the dedicated ASP.Net Forum  for more efficient responses, where you can contact ASP.NET experts. Thanks for understanding.
    Best regards,
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Trigger to execute query when value from LOV is selected

    HI Guys,
    I have a form in which I have 2 fields in Master and 4 fields in detail, all showing on the same canvas.
    I have put an 'execute_query' in when_new_form_instance trigger so that when I open the form it is pre - populated.
    The Master fields draw values from LOVs. I want to execute the master block query when the user selects a value from LOV, so in which trigger should I put it.
    I have tried in 'when_validate_item' and 'when_list_changed' triggers but it is showing an error.
    So, what should I do?
    Regards
    Ranjan

    I have designed a form in which there are two items in header level and two in line level. I have defined master - child relationship between the two blocks.
    I have put a execute_query for header in when_new_form_instance trigger so that when user opens the form, all fields are initially populated.
    Each Field has an LOV attached to it.
    Form Outline :
    Header : Ledger Name
    Ledger_approver
    Line : Approver
    Amount
    Initially all details for Ledger L1 is populated.
    If the user now selects Ledger L2 from LOV, then when he moves out of that item, immediately all details about L2 should get populated in the fields.
    I Have tried execute_query in when_validate_item of Ledger Name but I get error that we cannot use restricted procedure in when_validate_item trigger.
    I hope this explains my issue.
    Regards,
    Ranjan

  • Error handling when value is null

    hi i have a stuation where i what to display meaningfull error message if the lov is not selected,am navigating to next page based on lov selection,i what to display good message if you try to navigate without making selection
    public String showSelectedOrg() {
    BindingContext lBindingContext = BindingContext.getCurrent();
    BindingContainer bindings = lBindingContext.getCurrentBindingsEntry();
    // get the list binding for the Organisation lov
    JUCtrlListBinding list = (JUCtrlListBinding)bindings.get("Organisationid");
    if (list.isEmpty()) {
    JSFUtils.addFacesErrorMessage("Select Atleast One Organisation");
    // get the selected index from the list which is stored in the Orgidd1 attribute
    AttributeBinding attr = (AttributeBinding)bindings.getControlBinding("Orgid1");
    Integer selid = (Integer)attr.getInputValue();
    // load the listdata
    Object row = list.getDisplayData();
    // get the selected row from the list
    if (row == null){
    JSFUtils.addFacesErrorMessage("Select Atleast One Organisation");
    //JSFUtils.addFacesErrorMessage(msg);
    Row lFromList = (Row)list.getValueFromList(selid);
    if( lFromList.equals(null)){
    JSFUtils.addFacesErrorMessage("Select Atleast One Organisation");
    //JSFUtils.addFacesErrorMessage(msg);
    // from the row we get the PK the orgnasationId
    Object lAttribute = lFromList.getAttribute("Organisationid");
    Object orgname = lFromList.getAttribute("Organisationname");
    Number newVal = (Number)lAttribute;
    String neworg = (String)orgname;
    _logger.info("Information: selected Organisation = " + newVal);
    System.out.println("neworg " + newVal);
    System.out.println("testorg " + neworg);
    selectedState = neworg;
    // get the MethodAction for setCurrentRowWithKeyValue
    OperationBinding method = bindings.getOperationBinding("setCurrentRowWithKeyValue");
    // set hte needed parameter as the organisation id
    method.getParamsMap().put("rowKey", newVal);
    method.execute();
    // after execution check for errors
    if (list.isEmpty()) {
    JSFUtils.addFacesErrorMessage("Select Atleast One Organisation");
    List errors = method.getErrors();
    if (!errors.isEmpty()) {
    JSFUtils.addFacesErrorMessage("Select Atleast One Organisation");
    /* Exception ex = (Exception)errors.get(0);
    FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), "Select Atleast One Organisation");
    FacesContext.getCurrentInstance().addMessage(null, msg);*/
    // keep on page in case of an error
    return null;
    // navigate to the next page
    return "show";
    public static void addFacesErrorMessage(String msg) {
    FacesContext ctx = getFacesContext();
    FacesMessage fm =
    new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "");
    ctx.addMessage(getRootViewComponentId(), fm);
    currently am just geting NPE IN THIS LINE
    Row lFromList = (Row)list.getValueFromList(selid);
    Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
        at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
        at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
        at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1018)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:386)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
        ... 38 more
    Caused by: java.lang.NullPointerException
        at uam.cadastre.gov.za.OrgDetails.showSelectedOrg(OrgDetails.java:2414)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.el.parser.AstValue.invoke(Unknown Source)
        at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
        at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
        ... 45 more

    > currently am just geting NPE IN THIS LINE
    > Row lFromList = (Row)list.getValueFromList(selid);
    This cannot be true because the only possible cause for the NPE in this line is list. But if list was null you would have your NPE 13 lines earlier at
    > if (list.isEmpty()) {
    bye TPD

  • SELECT * cannot be used in an INSERT INTO query when the source or destination table contains a multivalued field

    Hi,
    I am using Access 2013 and I have the following VBA code, 
    strSQL = "INSERT INTO Master SELECT * from Master WHERE ID = 1"
     DoCmd.RunSQL (strSQL)
    when the SQL statement is run, I got this error.
    SELECT * cannot be used in an INSERT INTO query when the source or destination table contains a multivalued field
    Any suggestion on how to get around this?
    Please advice and your help would be greatly appreciated!

    Rather than modelling the many-to-many relationship type by means of a multi-valued field, do so by the conventional means of modelling the relationship type by a table which resolves it into two one-to-many relationship types.  You give no indication
    of what is being modelled here, so let's assume a generic model where there is a many-to-many relationship type between Masters and Slaves, for which you'd have the following tables:
    Masters
    ....MasterID  (PK)
    ....Master
    Slaves
    ....SlaveID  (PK)
    ....Slave
    and to model the relationship type:
    SlaveMastership
    ....SlaveID  (FK)
    ....MasterID  (FK)
    The primary key of the last is a composite one of the two foreign keys SlaveID and MasterID.
    You appear to be trying to insert duplicates of a subset of rows from the same table.  With the above structure, to do this you would firstly have to insert rows into the referenced table Masters for all columns bar the key, which, presuming this to be
    an autonumber column, would be assigned new values automatically.  To map these new rows to the same rows in Slaves as the original subset you would then need to insert rows into SlaveMastership with the same SlaveID values as those in Slaves referenced
    by those rows in Slavemastership which referenced the keys of the original subset of rows from Masters, and the MasterID values of the rows inserted in the first insert operation.  This would require joins to be made between the original and the new subsets
    of rows in two instances of Masters on other columns which constitute a candidate key of Masters, so that the rows from SlaveMastership can be identified.
    You'll find examples of these sort of insert operations in DecomposerDemo.zip in my public databases folder at:
    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
    If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
    In this little demo file non-normalized data from Excel is decomposed into a set of normalized tables.  Unlike your situation this does not involve duplication of rows into the same table, but the methodology for the insertion of rows into a table which
    models a many-to-many relationship type is broadly the same.
    The fact that you have this requirement to duplicate a subset of rows into the same table, however, does make me wonder about the validity of the underlying logical model.  I think it would help us if you could describe in detail just what in real world
    terms is being modelled by this table, and the purpose of the insert operation which you are attempting.
    Ken Sheridan, Stafford, England

  • How to retrieve multiple columns using "returning" in the Insert query.

    hi,
    wanted to know how to retrieve multiple columns using "returning" in the Insert Query.
    For retrieving one column we write the query as follows:
    Insert into TABLE values(1,2,3,4) returning COLUMN1 into PARAMETER
    But can we retrive multiple columns in the same query?
    am using oracle 10g and coding in .NET

    Hi,
    You can definetely get multiple values from a single query using the 'returning' clause.
    Eg : insert into emp (empno, ename, job, deptno) values (7324,'ADAM','MARKETING',30) returning ename, deptno into var1, var2; PN : var1 & var2 to be declared as varchar2 & number respectively.
    More insight into the 'RETURNING' clause in this link.
    http://www.samoratech.com/PLSQL/swArtPLSQLReturn.htm
    Regards,
    Bhanu.

  • Passing column name dianamically in an insert query

    i have a procedure hwre i used an inser query.eg
    insert into table (a,b,c) values(...)
    i need to pass a,b,c ie column names as parameter.depending upon the condition the column name will change.

    You don't necessarily need to use dynamic SQL;
    create or replace procedure p
      p_a number default null,
      p_b number default null,
      p_c number default null
    ) is
    begin
      insert into t
      values
        (p_a, p_b, p_c);
    end;
    Procedure createdUsing named notation;
    exec p(p_a =>1, p_c => 3);
    PL/SQL procedure successfully completed
    exec p(p_b =>20, p_c => 30);
    PL/SQL procedure successfully completedPassing NULLs;
    exec p(4, null, 6);
    PL/SQL procedure successfully completed
    exec p(40, 50, null);
    PL/SQL procedure successfully completed
    select * from t;
             A          B          C
             1                     3
                       20         30
             4                     6
            40         50

  • Prevent Column Shrinking when Resizing Browser

    Hi,
    I'm designing a site with tables and I want to prevent the columns within the tables from shrinking when the browser is resized.
    Please reference the below code of two tables.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <table width="520" cellspacing="0" cellpadding="0">
      <tr>
        <td width="10" align="left" valign="top" bgcolor="#FFFFFF"> </td>
        <td align="left" valign="top" bgcolor="#CCCCCC">this column does not resize but the table is aligned left.</td>
        <td width="10" align="left" valign="top" bgcolor="#FFFFFF"> </td>
      </tr>
    </table>
    <P align=left>
    <table width="100%" height="10" cellspacing="0" cellpadding="0" margin-top:="margin-top:" "0px" bgcolor="#FFFFFF">
      <tr>
        <td> </td>
        <td width="10" align="left" valign="top"> </td>
        <td width="500" align="left" valign="top" bgcolor="#CCCCCC">This column I want to prevent from shrinking in a browser</td>
        <td width="10" align="left" valign="top"> </td>
        <td> </td>
      </tr>
    </table>
    </body>
    </html>

    Liquid Layouts = % based.  Resizes to browser viewport.
    Example: http://alt-web.com/TEMPLATES/3-col-liq-layout.shtml
    Semi-Liquid Layouts = % based plus min- and max-width restrictions.
    Example:  http://alt-web.com/TEMPLATES/3-col-semi-liq-layout.shtml
    Fixed width Layouts = pixel based.
    Example:  http://alt-web.com/TEMPLATES/3-col-white-gray.shtml
    Elastic Layouts = em based. Re-sizes entire layout based on inc/dec text size.
    Example:  http://alt-web.com/TEST/Resizable-ems-test.html
    CSS:
    body {
    width: 1000px; /**width in %, px or em*/
    margin:0 auto; /** with width, this centers page on screen**/
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Oracle 10g Insert query performs inconsistent as a query vs procedure and p

    Database Version: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    No error messages....
    I am facing a very weird issue that I have a insert statement in a procedure... pretty much
    inert
    into oracle_Table
    SELECT cr.a AS a,
    cr.b AS b,
    cr.c AS c,
    max(d.column_name) as d
    FROM "table 1"@Pmo.World Cr,
    [email protected] d
    WHERE d."a" = cr."column name"
    GROUP BY cr.a,
    cr.b,
    cr.c
    @Pmo.World is a database link to a MSSQL...
    The problem I am having right now is, every time I run this insert as a query. Everything works as what it should be... However, when I put this insert into a procedure, it inserts nothing...
    Simple test Proceudre:
    declare
    -- Local variables here
    i integer;
    begin
    inert
    into oracle_Table
    SELECT cr.a AS a,
    cr.b AS b,
    cr.c AS c,
    max(d.column_name) as d
    FROM "table 1"@Pmo.World Cr,
    [email protected] d
    WHERE d."a" = cr."column name"
    GROUP BY cr.a,
    cr.b,
    cr.c
    end;
    Thinking about character conversion issue I changed the procedure to
    inert
    into oracle_Table
    SELECT to_char(cr.a) AS a,
    to_char(cr.b) AS b,
    to_char(cr.c) AS c,
    max(d.column_name) as d
    FROM "table 1"@Pmo.World Cr,
    [email protected] d
    WHERE d."a" = cr."column name"
    GROUP BY cr.a,
    cr.b,
    cr.c
    Then this Inser works in the procedure... however when I revert it back with the original version that doesnt have to_char... it is working still... then I kept it running for few days... since it runs once per day, it was working for the first 2 days and then stopped working the third day... I verified the source table and every time this procedure runs, source tables were not empty...
    It is so confusing because if I manually run the insert as a query, it worked every time I ran it... however if I put that into a procedure, it works from time to time..
    Any help is highly apprecaited
    Edited by: 986006 on Feb 4, 2013 8:51 AM

    986006 wrote:
    Thanks for the hints up... I have updated my post... As I post the test procedure...it is about the exact the same as the insert query... Every time, the insert would actually insert data into the table but every time I run the test procedure, nothing gets inserted in... It sounds unbelievable but it happens... ThanksYou obviously haven't read the FAQ, or at least you haven't bothered doing what it asks. Help us to help you.
    Can you recreate the problem with simpler data on your local machine? If so provide create table and insert statements for test data.
    Format your code and place between tags.
    At the very least post the *exact* SQL or PL/SQL you are trying to run: what you've posted isn't even valid SQL.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Would it be faster to use a trigger or modify the insert query?

    We have a table that currently has latitude, longitude columns and are trying to decide what route to go as far as adding spatial data to future records. A spatial index will be placed on the new column.
    There appear to be 3 solutions:
    1 Create a materialized view which creates the spatial column based on the current latitude and longitude columns.
    2 Create a trigger on the table that will populate the new spatial column on insert/update.
    3 Modify the code to insert a spatial value into the new spatial column.
    Due to the nature of the data we are not willing to use method 1.
    What we are trying to figure out is which method, 2 or 3, will insert faster.
    Has anyone done tests to determine if an insert with a spatial object is slower than an insert on a table with a trigger that creates a spatial object?
    Thanks,
    Pat

    Pat,
    Note that you don't need to store latitude, longitude in sdo_geometry type in order to spatially index it. Instead you can create a function that returns an sdo_geometry based on two numeric columns, then create a function based index on that. Its described here:
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11830/sdo_exten.htm#i1005799
    Also note that in the sdo_geometry type, you need to define the data as longitude/latitude and not the other way around.
    If you do want to create a column with sdo_geometry column, I'd recommend your third option. As a general principle I avoid triggers unless absolutely necessary. Triggers invariably lead to confusion when you (or someone else) revisits this code in the future. Also the change of context between and SQL and PL/SQL has a performance hit. Here's a simple test:
    SQL> CREATE TABLE long_lat_no_trigger (
      2     geometry                SDO_GEOMETRY);
    Table created.
    SQL>
    SQL> CREATE TABLE long_lat_with_trigger (
      2     longitude               NUMBER,
      3     latitude                NUMBER,
      4     geometry                SDO_GEOMETRY);
    Table created.
    SQL>
    SQL> CREATE OR REPLACE TRIGGER long_lat_to_geometry
      2  BEFORE INSERT ON long_lat_with_trigger FOR EACH ROW
      3  DECLARE
      4  BEGIN
      5     :new.geometry := SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(
      6     :new.longitude, :new.latitude, NULL), NULL, NULL);
      7  END;
      8  /
    Trigger created.
    SQL>
    SQL> SET TIMING ON
    SQL> INSERT INTO long_lat_no_trigger (geometry) (
      2     SELECT
      3     SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(
      4     dbms_random.value(0,180), dbms_random.value(0,90),
      5     NULL), NULL, NULL)
      6     FROM DUAL
      7     CONNECT BY LEVEL <= 1000000);
    1000000 rows created.
    Elapsed: 00:00:31.96
    SQL>
    SQL> INSERT INTO long_lat_with_trigger (longitude, latitude) (
      2     SELECT
      3     dbms_random.value(0,180),
      4     dbms_random.value(0,90)
      5     FROM DUAL
      6     CONNECT BY LEVEL <= 1000000);
    1000000 rows created.
    Elapsed: 00:01:21.15Cheers,
    John

  • Checking the status of the insert query in JSP

    frendz,
    i am working with JSP .i have some content to be inserted in the database.i have used the insert query in SQL for that.i am able to check whether it has been inserted properly in the SQL but i want to check the status of the insert query with its return value(so that i can confirm it does not return a error).so please help.

    The Statement#executeUpdate() returns an int with the row count. Get hold of it.
    Also see the Statement API: http://java.sun.com/javase/6/docs/api/java/sql/Statement.html
    Apart from this, I recommend you to use PreparedStatement instead. It will not only ease setting Java objects in a query (no hassle anymore with quotes), but it will also prevent you from SQL injections.
    Prepare here: http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
    SQL injections: http://en.wikipedia.org/wiki/SQL_injection

  • How can i insert the variable value in MS ACCES Query

    i am creating one Query (query1) in MS ACCESS ( like we creaate Tables, Forms and Reports in MS ACCESS ) in this Query i have given 2 constent value in BETWEEN CLAUSE , after that i Created a CROSS QUERY which is based on the privious Query (query1).
    Now i want to insert the variable value using JSP and HTML in to Query(query1).
    Doing this i want to execute the Query (query1) with variable perameters and
    wants to get the risponce form CROSS QUERY.
    In this matter how can i insert the value in Query(query1) using JDBC and JSP.

    The query is
    Select ZMSGMAP.GROUP_CODE as 'group', ZMSDSTATE.STATE_DESC as 'state', ZMSTRN.YRMON, sum(ZMSTRN.CMAQTY) as 'qty' from ZMSDSTATE,ZMSGMAP,ZMSTRN Where ZMSTRN.STATE=ZMSDSTATE.STATE and ZMSTRN.PLANT=ZMSGMAP.PLANT_CODE and ZMSTRN.YRMON between "+p1+" and "+p2+" Group by ZMDGMAP.GROUP_CODE, ZMSDSTATE.STSTE_DESC, ZMSTRN.YRMONUsing this query i m trying to display the risult but the YRMON is displaying in a single column, i want to display it ia seperat columns. here p1 and p2 is YRMON(it is the yer month like 200102), for this solution i have created Cross table Query which is based on uper Query (query1) and design it column wise Display, it is givng the right display, but the problem is this i m not getting the technique throw which i can insert the variable values in to the query1 (which is designed in MS ACCESS).
    u can contact me on [email protected] for more details.

  • Resolve column names in a sql Query

    Hi Folks,
         I’m upgrading an application and there are database columns that have major changes that could affect production reports. I would like to survey v$SQL for a few days to see if these columns are affected. Here’s the problem.
    Looking at a SQL query to determine which columns are used is not nearly as easy as it sounds. Are there any oracle functions or 3rd party tools that can be used to list the columns used by a sql query? (this gets extremely tricky when subqueries become involved)
    For instance.
    select
    name, b.dep_id, employee_id
    From emp a
    Inner join v_department b on a.dep_id=b.dep_id
    Columns used:+
    Emp.name+
    Departments.dep_id (under the view)+
    Emp.employee_id+
    Emp.dep_id (from the join)+

    If you're on > 10g, you can use dbms_xplan with "all" option.
    It shows "column projection information" which is exactly what you want.
    UKJA@ukja102> set serveroutput on
    UKJA@ukja102>
    UKJA@ukja102> drop table t1 purge;
    Table dropped.
    Elapsed: 00:00:00.03
    UKJA@ukja102> create table t1(c1 int, c2 int);
    Table created.
    Elapsed: 00:00:00.03
    UKJA@ukja102>
    UKJA@ukja102> explain plan for
      2  select
      3    t1.c1, t1.c2, v.cnt
      4  from t1,
      5    (select /*+ no_merge */ c1, count(*) as cnt
      6        from t1
      7        group by c1) v
      8  where
      9    t1.c1 = v.c1
    10  ;
    Explained.
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102> @plan_all
    UKJA@ukja102> select * from table(dbms_xplan.display(null,null,'all'))
      2  /
    PLAN_TABLE_OUTPUT                                                              
    Plan hash value: 536125944                                                     
    | Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |  
    |   0 | SELECT STATEMENT     |      |     1 |    52 |     6  (34)| 00:00:01 |  
    |*  1 |  HASH JOIN           |      |     1 |    52 |     6  (34)| 00:00:01 |  
    |   2 |   TABLE ACCESS FULL  | T1   |     1 |    26 |     2   (0)| 00:00:01 |  
    |   3 |   VIEW               |      |     1 |    26 |     3  (34)| 00:00:01 |  
    |   4 |    HASH GROUP BY     |      |     1 |    13 |     3  (34)| 00:00:01 |  
    |   5 |     TABLE ACCESS FULL| T1   |     1 |    13 |     2   (0)| 00:00:01 |  
    Query Block Name / Object Alias (identified by operation id):                  
       1 - SEL$1                                                                   
       2 - SEL$1 / T1@SEL$1                                                        
       3 - SEL$2 / V@SEL$1                                                         
       4 - SEL$2                                                                   
       5 - SEL$2 / T1@SEL$2                                                        
    Predicate Information (identified by operation id):                            
       1 - access("T1"."C1"="V"."C1")                                              
    Column Projection Information (identified by operation id):                    
       1 - (#keys=1) "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22],                   
           "V"."CNT"[NUMBER,22]                                                    
       2 - "T1"."C1"[NUMBER,22], "T1"."C2"[NUMBER,22]                              
       3 - "V"."C1"[NUMBER,22], "V"."CNT"[NUMBER,22]                               
       4 - (#keys=1) "C1"[NUMBER,22], COUNT(*)[22]                                 
       5 - "C1"[NUMBER,22]                                                         
    Note                                                                           
       - dynamic sampling used for this statement                                  
    40 rows selected.
    Elapsed: 00:00:00.01
    UKJA@ukja102>
    UKJA@ukja102>
    UKJA@ukja102> @end
    UKJA@ukja102> set echo offDion Cho

  • Errors executing bulk query when updating a Sharepoint Linked List from Access

    Hi all,
    I have a Sharepoint list that is a Linked List with MS Access. It has just under 5,000 items (4,864), thus meaning it avoids the reduction in functionality lists of greater than 5,000 items have.
    Among the list are five calculated columns. These take the information from another column (different employee numbers), and by using a formula produce a clickable link to my company's Directory page, where that particular employee's info is displayed. I'm
    not sure if these five columns are relevant to my query, but I'm mentioning them in case.
    My problem is this: Frequently when I run any query on the list that updates the list, I get this error: "There were errors executing the bulk query or sending the data to the server. Reconnect the tables to resolve the
    conflicts or discard the pending changes".
    When I review the errors, it says they conflict with errors a previous user made (with that previous user being me). It frequently highlights several columns, despite the info in them being identical, and the calculated columns (with the original showing
    the value they contained and the new showing #VALUE! (as Access can't display the formulas).
    However, if I click Retry All Changes, all the update stick and everything seems fine. Why is this happening? It's proving very annoying and is really stopping the automation of my large number of queries. A list of 5000 items isn't particular big (and they've
    got roughly 100 columns, although I didn't think that was too large either, given Excel's 200+ column limit).
    Is this due to poor query design and SQL? Is this due to connectivity issues (which I doubt, as my line seems perfect)? Is this due to Access tripping over itself and not executing the update on each row in the table, but rather executing them concurrently
    and locking itself up? I'm at wit's end about it and really need to get this sorted.
    Thanks in advance for any suggestions.

    Hi amartin903,
    According to your description, my understanding is that you got an error when you used a linked list from Access.
    The table that you are updating is a linked table that does not have a primary key or a unique index. Or, the query or the form is based on a linked table that does not have a primary key or a unique index. Please add the primary key or a unique index.
    Here is a similar post, please take a look at:
    http://social.technet.microsoft.com/Forums/en-US/545601e9-a703-4a02-8ed9-199f1ce9dac8/updating-sharepoint-list-from-access?forum=sharepointdevelopmentlegacy
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Tools | Insert Query no longer supported with SAPBEX 7.0 ?

    Hi
    With SAPBEX for BW 3.5 we could use Tools | Insert Query ... in individual worksheets and then save this as a workbook. 
    Now for BW 7.0, the SAPBEX does not seem to be able to do this and the end-user must "paint" the query by inserting a navigation area, filter block and results area into the sheet and then bind these objects to an infoprovider.
    My users will struggle with this new method - has the Insert function been removed or is it hiding somewhere ?
    regards
    Ian MacLaren

    Hi,
    it's very borring to re-design a query for each sheet...
    So there is an helpful option :
    1) Open Bex Analyser
    2) Open your query
    3) DIsplay the Navigation pane (thanks to the button filter)
    4) In the navigation pane, right click on a caracteristic that is not display in your analysis grid yet
    5) choose the last option "Drill <name of the caracteristic> Across Sheets"
    6) It will duplicate the query for each value of the caracteristic, in a individual sheet for each value.
    (so... choose a caracteristic with less than 10 values)
    7) now you've got several sheets but no data.
    8) Refresh the workbook
    Now, you've got a workbook with several sheet with the same design.
    You just have to go in conception mode and change the dataprovider of the different object into each sheet.
    N.B : The button chart, filter, information doesn't work for news sheet...
    you will have to develop VBA macro or just use Excel function : Data > Group and Outline > Group... in order to hide and unhide lines and column quickly.
    Hope it's help
    Don't forget point.

Maybe you are looking for