Update query (or other method) to a typed dataset

Hi
i have created a typed DataSet in code that is created at runtime. It gets populated then it needs to be updated based on 2 paramaters
EmployeeID & AssignmentID
How can i run an update query on the runtime created Dataset? Hee is how i create my Dataset-
Private sGridDataSet As New DataSet("GridDataset")
Private tblGridTable As DataTable
sGridDataSet.CaseSensitive = False
tblGridTable = sGridDataSet.Tables.Add("tblGrid")
With tblGridTable
.Columns.Add("AssignmentID", GetType(System.String))
.Columns.Add("ProjectName", GetType(System.String))
.Columns.Add("Day1", GetType(System.String))
.Columns.Add("Day2", GetType(System.String))
.Columns.Add("Day3", GetType(System.String))
.Columns.Add("Day4", GetType(System.String))
.Columns.Add("Day5", GetType(System.String))
.Columns.Add("Day6", GetType(System.String))
.Columns.Add("Day7", GetType(System.String))
End With
'get data from qryAssignments
sAssignID = Me.AssignmentData.qryAssignments.Rows(j)(1)
sProjName = Me.AssignmentData.qryAssignments.Rows(j)(0)
newValues = {sAssignID, sProjName, Day1, Day2, Day3, Day4, Day5, Day6, Day7}
tblGridTable.Rows.Add(newValues)
Me.QryAssignmentsTableAdapter.ClearBeforeFill = True
Dim sDate As Date = Me.txtDate.Text
Dim EndDate As Date = sDate.AddDays(6)
Me.QryAssignmentTimesTableAdapter.Fill(Me.AssignmentData.qryAssignmentTimes, Me.txtEmployeeID.Text, Me.txtDate.Text, CStr(CType(CStr(EndDate), DateTime)))
Dim p As Integer = 0
For p = 0 To Me.AssignmentData.qryAssignmentTimes.Rows.Count - 1
vDayNo = Weekday(Me.AssignmentData.qryAssignmentTimes.Rows(p)(0), FirstDayOfWeek.Monday)
Dim m As String = Me.AssignmentData.qryAssignmentTimes.Rows(p)(0)
'NEED TO UPDATE DATASET TABLE HERE BASED ON EMPLOYEEID AND ASSIGNMENTID
Next
Me.GridControl1.DataSource = tblGridTable
Hopefully, someone can give me a few pointers :)
Thanks
Nigel
Nacho is the derivative of Nigel "True fact!"

Hello,
If I have more than one table to work with, a DataSet would be the container while if one table then no DataSet, just a DataTable. I would use code similar to the following which is for MS-Access yet by changing to SqlClient data provider instead of OelDb
data provider the same methods work.
Taken from
this project.
Module DatabaseOperations
Private Builder As New OleDb.OleDbConnectionStringBuilder With
.Provider = "Microsoft.ACE.OLEDB.12.0",
.DataSource = IO.Path.Combine(Application.StartupPath, "Database1.accdb")
''' <summary>
''' Read USA customers from database into a DataTable
''' </summary>
''' <returns></returns>
''' <remarks>
''' Database is assumed to be in the Bin\Debug folder.
''' </remarks>
Public Function LoadCustomers() As DataTable
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText =
<SQL>
SELECT
Identifier,
CompanyName,
ContactName,
ContactTitle,
Address,
City,
PostalCode,
Country
FROM Customer;
</SQL>.Value
Dim dt As New DataTable With {.TableName = "Customer"}
Try
cn.Open()
dt.Load(cmd.ExecuteReader)
dt.Columns("Identifier").ColumnMapping = MappingType.Hidden
dt.Columns("Country").ColumnMapping = MappingType.Hidden
Catch ex As Exception
MessageBox.Show("Failed to load customer data. See error message below" & Environment.NewLine & ex.Message)
End Try
dt.AcceptChanges()
Return dt
End Using
End Using
End Function
Public Function RemoveCurrentCustomer(ByVal Identfier As Integer) As Boolean
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText = "DELETE FROM Customer WHERE Identifier = ?"
Dim IdentifierParameter As New OleDb.OleDbParameter With
.DbType = DbType.Int32,
.ParameterName = "P1",
.Value = Identfier
cmd.Parameters.Add(IdentifierParameter)
Try
cn.Open()
Dim Affected = cmd.ExecuteNonQuery
Return Affected = 1
Catch ex As Exception
Return False
End Try
End Using
End Using
Catch ex As Exception
' Handle or not handle exceptions for failed save operation
Return False
End Try
End Function
Public Function AddNewRow(ByVal Name As String, ByVal Contact As String, ByRef Identfier As Integer) As Boolean
Dim Success As Boolean = True
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText =
<SQL>
INSERT INTO Customer
CompanyName,
ContactName
Values
@CompanyName,
@ContactName
</SQL>.Value
cmd.Parameters.AddWithValue("@CompanyName", Name)
cmd.Parameters.AddWithValue("@ContactName", Contact)
cn.Open()
cmd.ExecuteNonQuery()
cmd.CommandText = "Select @@Identity"
Identfier = CInt(cmd.ExecuteScalar)
End Using
End Using
Catch ex As Exception
Success = False
End Try
Return Success
End Function
Public Function SaveChanges(ByVal sender As DataRow) As Boolean
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText =
<SQL>
UPDATE
Customer
SET
CompanyName=?,
ContactName=?
WHERE Identifier = ?
</SQL>.Value
Dim CompanyNameParameter As New OleDb.OleDbParameter With
.DbType = DbType.String,
.ParameterName = "P1",
.Value = sender.Field(Of String)("CompanyName")
cmd.Parameters.Add(CompanyNameParameter)
Dim ContactNameParameter As New OleDb.OleDbParameter With
.DbType = DbType.String,
.ParameterName = "P2",
.Value = sender.Field(Of String)("ContactName")
cmd.Parameters.Add(ContactNameParameter)
Dim IdentifierParameter As New OleDb.OleDbParameter With
.DbType = DbType.Int32,
.ParameterName = "P3",
.Value = sender.Field(Of Int32)("Identifier")
cmd.Parameters.Add(IdentifierParameter)
Try
cn.Open()
Dim Affected = cmd.ExecuteNonQuery
Return Affected = 1
Catch ex As Exception
Return False
End Try
End Using
End Using
Catch ex As Exception
' Handle or not handle exceptions for failed save operation
Return False
End Try
End Function
End Module
Here is an example of retrieving a row of data via a where condition
Public Sub LoadSingle(ByVal Identifier As Integer)
Using cn As New OleDb.OleDbConnection With
.ConnectionString = Builder.ConnectionString
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText =
<SQL>
SELECT
Identifier,
CompanyName,
ContactName
FROM
Customers
WHERE Identifier=@Identifier
</SQL>.Value
cmd.Parameters.Add(New OleDb.OleDbParameter With
.DbType = DbType.Int32,
.ParameterName = "@Identifier",
.Value = Identifier
cn.Open()
Dim Reader As OleDb.OleDbDataReader = cmd.ExecuteReader
If Reader.HasRows Then
Reader.Read()
Console.WriteLine("Name: {0} Contact name: {1}",
Reader.GetString(1), Reader.GetString(2))
End If
End Using
End Using
End Sub
Here you can see (using a random example) that SQL-Server code uses the same logic and methods
Using cn As New SqlConnection With {.ConnectionString = MyConnectionString}
Dim CompanySearch As String = "An"
Using cmd As New SqlCommand With {.Connection = cn}
cmd.CommandText =
<SQL>
SELECT CompanyName
FROM
Customers
WHERE
CompanyName LIKE @CompanyName
</SQL>.Value
cmd.Parameters.Add(
New SqlParameter With
.DbType = DbType.String,
.Value = CompanySearch & "%",
.ParameterName = "@CompanyName"
cn.Open()
Dim Reader = cmd.ExecuteReader
If Reader.HasRows Then
While Reader.Read
Console.WriteLine(Reader.GetString(0))
End While
Else
Console.WriteLine("No matches")
End If
End Using
End Using
So all the above is "hand coding" and there is still the option to use Adapters but for simple stuff they are over kill. The only benefit for them with simple stuff is if you are a visual person, thats it.
See also:
This article on creating SQL statement as per how I did it in the examples above. In the next release of Visual Studio this method will be easier similar to C#
Currently in C# we can do this
string selectStatement = @"
SELECT CompanyName
FROM
Customers
WHERE
CompanyName LIKE @CompanyName";
On creating a DataTable, check out this simple utility
https://code.msdn.microsoft.com/DataTable-creator-95b655b3
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

Similar Messages

  • Can not execute a simple update query with ms access

    Hi
    I am trying to execute a simple update query , this is the code I am running : I get no exeptions but the db is not being updated .
    When I copy my query into access it works !
    The table / columns are spelled correctly and I am able to execute select queries.
    can anyone figure out what is going on
    Thanks shahar
    public static void main(String[] args) {
    MainManager mainManager = MainManager.getInstance();
    Log log = Log.getInstance();
    try {
    log.writeDebugMessage("befor executing query");
    //stmt.executeUpdate("update trainee set Trainee_Name = 'shahar&Rafi' where Trainee_Id = 1 ");
    //stmt = null ;
    PreparedStatement stmt1 = con.prepareStatement("UPDATE Trainee SET Trainee_Name =? WHERE Trainee_Id =?");
    String name = new String("Shahar&Rafi");
    int Id = 1 ;
    stmt1.setString(1,name);
    stmt1.setInt(2,Id);
    System.out.println(stmt1.toString());
    stmt1.execute();
    log.writeDebugMessage("After executing query");
    catch (SQLException e ){
    System.err.println("SQLException: " + e.getMessage());
    }

    Hi All,
    got the problem solved at last.
    first, in the SQL string all the values must be within " ' "
    for example:
    INSERT INTO Trainee(Trainee_Id , Trainee_password , Trainee_Address, Trainee_Name , Trainee_Phone , Trainee_Gender , Trainee_SessionTime , Trainee_Purpose , Trainee_HealthStatus , Trainee_StartDate , Trainee_Birthday) VALUES (6,'333','hhhh','rafi',048231821,true,63,4,true, ('Feb 22, 2002'), ('Feb 22, 2002'))
    second and more important,
    a 'dummy' sql select query must be performed after an update query
    example for code:
    try{
    DB.MainManager.getInstance().ExecuteUpdateQuery(A);
    DB.MainManager.getInstance().getStatement().executeQuery("SELECT * FROM Trainee");
    where A is the update query.

  • What other methods are there to re-install Win 8.1 pro without losing files & programs, if I am unable to update my Recovery image?

    So I am thinking my Windows 8.1 Pro needs a refresh, but I have not ran "recimg /createimage C:\*" for a while and because of the problems I have. I cannot create a new one, it just wont work and I've had a post on here about that issue for a while
    now and nothing has worked.  So I know I need to re-install windows but I really want to be able to keep my Programs & files.
    So my question is, are there any other methods to re-install Windows 8.1 pro without losing my programs?
    That's the reason I have not just done a reinstall, because of the time and effort needed to do this in a timely manner.  Also I need to keep my programs APPDATA intact so that my applications still work as they do now, some programs have got months
    of history and data.  Also I am not certain I still have the installers for some of my applications, I know I can get them but again its the time it would take.
    This is why I run a separate backup of my APPDATA DIR, am I right in thinking that If I did have to reinstall that I could just restore the old APPDATA data to the new Install and my programs would automatically have all there normal settings?
    So what are my options?
    Thanks peeps.
    JK MCP

    Isn't that only used when a PC will not boot?
    What options does booting with this give me?
    Thanks
    JK MCP
    Hi,
    USB recovery disk was used to recover your system when it encounter problem. You can try to use it to fix your problem instead reinstall system. However, there is no method to keep your program whenreinstall system.
    Roger Lu
    TechNet Community Support

  • Update query not working from edit page

    Next incident with the guestbook saga:
    Successful execution of gb_entry_mstr_det_e.cfm with URL:
    http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14 all have database current info...this is good, but:
    textboxes
    Problem 1:
    the SELECT field does not does not reflect/display the correct option I know exists in the database
    the database field whence this SELECT object is supposed to display is a number, not text.
    now,...
    Problem 2:
    Clicked on "Update Your Entry" button at bottom of edit page (to update by going to gb_confirm_update.cfm)
    <INPUT
    TYPE="submit"
    NAME="submit"
    VALUE="Update Your Entry">
    then, arriving at the gb_confirm_update.cfm page, ...
    Got an error (below) executing the page: gb_confirm_update.cfm with resulting URL:
    http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
    --- snippet from template gb_confirm_update.cfm
    <CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
    UPDATE gb_entries
    SET
    gb_entry_stts_='form.gb_entry_stts_',
    gb_entry_nm_f='form.gb_entry_nm_f',
    gb_entry_nm_l='form.gb_entry_nm_l',
    gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x,
    gb_entry_tce='form.gb_entry_tce',
    gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x,
    gb_entry_cy='form.gb_entry_cy',
    gb_entry_stt='form.gb_entry_stt',
    gb_entry_instr='form.gb_entry_instr',
    gb_entry_m='form.gb_entry_m',
    gb_entry_del_x=form.gb_entry_del_x
    WHERE gb_entryID=form.gb_entryID
    </CFQUERY>
    --- end snippet ---
    =================================================
    Error Executing Database Query. 
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 4. 
    The error occurred in E:\benoitsystems.com\wwwroot\ww\bd\gb\gb_confirm_update.cfm: line 2
    1 : <!--- <CFUPDATE DATASOURCE="9130.ww" TABLENAME="gb_entries"> --->
    2 : <CFQUERY DATASOURCE="9130.ww" NAME="ww_gb_ud">
    3 : UPDATE gb_entries
    4 : SET
    SQL    UPDATE gb_entries SET gb_entry_stts_='form.gb_entry_stts_', gb_entry_nm_f='form.gb_entry_nm_f', gb_entry_nm_l='form.gb_entry_nm_l', gb_entry_nm_l_dspl_x=form.gb_entry_nm_l_dspl_x, gb_entry_tce='form.gb_entry_tce', gb_entry_tce_dspl_x=form.gb_entry_tce_dspl_x, gb_entry_cy='form.gb_entry_cy', gb_entry_stt='form.gb_entry_stt', gb_entry_instr='form.gb_entry_instr', gb_entry_m='form.gb_entry_m', gb_entry_del_x=form.gb_entry_del_x WHERE gb_entryID=form.gb_entryID 
    DATASOURCE   9130.ww
    VENDORERRORCODE   -3010
    SQLSTATE   07002
    Please try the following:
    Check the ColdFusion documentation to verify that you are using the correct syntax.
    Search the Knowledge Base to find a solution to your problem.
    Browser   Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
    Remote Address   71.233.234.226
    Referrer   http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=14
    Date/Time   21-Jul-10 03:11 PM
    =================================================
    I have every NAME of each object matching, verbatum, in the UPDATE query, and every database field name correct in teh query also.

    I was encouraged to send snippets in an another submission, and now I believe it is best that I  "lay my cards on the table"
    Here's my hand:
    Pages in question for your review:
    http://www.benoitsystems.com/ww/bd/gb/gb_mstr.cfm  click on the pencil (the toilet will delete the record.
    http://www.benoitsystems.com/ww/bd/gb/gb_entry_mstr_det_e.cfm?call_number=21  go to bottom of webpage and click “Update Your Entry”
    http://www.benoitsystems.com/ww/bd/gb/gb_confirm_update.cfm?call_number=#gb_entryID#
    In your review of the above (should you choose) before clicking on the pencil, look at the status on the master listing record you will be editing, and feel free to edit.  Most statuses will be “Hold”
    Two dummy MS Access database tables:
    Table 1: "gb_entries" (Guestbook)
    field 1: gb_entries_ID (Autonumber - Long Integer)
    field 2: gb_entries_dt (date/time)
    field 3: gb_entries_nm_f (Text)
    field 4: gb_entries_nm_l (Text)
    field 5: gb_entries_nm_stts_ (Number field - Byte (not bit)) (fed by gb_sttsID)
    couple other text fields
    field 6: gb_entries_em (Text)
    field 7: gb_entries_cy (Text)
    field 8: gb_entries_stt (Text)
    field 9: gb_entries_nm_l_dspl (Yes/No or True/False)
    field 10: gb_entries_m (Memo type)
    Table 2: "gb_stts_rf" (Guestbook Status Reference)
    field 1: gb_sttsID (Autonumber - Long Integer)
    field 2: gb_stts (Text)
    Two Templates:
    This is the edit page (where a person with administrative access may edit the status or change the spelling for someone, etc.):
    <!--- This query fills the form with the chosen record data (except for the darned SELECT object) ---> <CFQUERY NAME="edit_entry" DATASOURCE="9130.ww"> SELECT * FROM gb_entries WHERE #call_number#=gb_entryID </CFQUERY>
    <!--- This query is for the select dropdown of guestbook status options (set to default on “Hold” from gb_nw.cfm) ---> <CFQUERY NAME="q_stts" DATASOURCE="9130.ww"> SELECT * FROM gb_stts_rf </CFQUERY>
    <HTML>
    <HEAD>
    <TITLE>Woodwindology Guestbook Entry Edit Page</TITLE> <CFOUTPUT QUERY="incl_css_bd">#incl_code#</CFOUTPUT>
    </HEAD>
    <BODY
          BGPROPERTIES="fixed">
    <DIV ALIGN="center">
    <IMG
          SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/pg/guestbook.gif"
          BORDER="0">
    <BR>
    <IMG
          SRC="<CFOUTPUT>#baseurl#</CFOUTPUT>md/img/ut/ttl/sub/edit_entry.gif"
          BORDER="0">
    <BR>
    Developer View
    </DIV>
    <TABLE>
          <TR>
                <TD>
                      <TABLE
                            WIDTH="100%"
                            BORDER="0"
                            CELLPADDING="5"
                            CELLSPACING="0">
          <TR>
                <TD VALIGN="top">
                      <FORM
                            NAME="f_gb_entry_mstr"
                            ACTION="gb_confirm_update.cfm?call_number=#gb_entryID#"
                            METHOD="post">
                      <CFOUTPUT QUERY="edit_entry">
                      <B>Entry ID:</B>
                      #gb_entryID#     
                      <INPUT
                            TYPE="hidden"
                            NAME="gb_entryID"
                            VALUE="#gb_entryID#">
                      <P>
                      <B>Entry Date and Time:</B>
                      #DateFormat("#gb_entry_dt#","mmmm d, yyyy")# #TimeFormat("#gb_entry_dt#","h:mm tt")#
    <P>
                      <B>Entry Status:</B>
                      <SELECT
                            NAME="gb_entry_stts_"
                            VALUE="#gb_entry_stts_#">
    </CFOUTPUT>
                            <CFOUTPUT QUERY="q_stts">
                                  <OPTION VALUE="#gb_sttsID#">#gb_stts#</OPTION>
                            </CFOUTPUT>
                      </SELECT>
                      <P>
    <CFOUTPUT QUERY="edit_entry">
                      <B>Guest's First Name:</B>
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_nm_f"
                            VALUE="#gb_entry_nm_f#">
                      <P>
                      <B>Guest's Last Name:</B>
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_nm_l"
                            VALUE="#gb_entry_nm_l#">
                      <BR>
                      Display Last Name:
                      <INPUT
                            TYPE="radio"
                            NAME="gb_entry_nm_l_dspl_x"
                            VALUE="Yes">
                      Do Not Display Last Name:
                      <INPUT
                            TYPE="radio"
                            NAME="gb_entry_nm_l_dspl_x"
                            VALUE="no">
                            <P>
                            <B>Your Email Address:</B><BR>
                            <INPUT
                                  TYPE="text"
                                  NAME="gb_entry_tce"
                                  VALUE="#gb_entry_tce#"
                                  SIZE="40"
                                  MAXLENGTH="40">
                      <BR>
                      Uncheck the box to keep email private:
                      <INPUT
                            TYPE="checkbox"
                            NAME="gb_entry_tce_dspl_x"
                            VALUE="#gb_entry_tce_dspl_x#">
                      <P>
                      <SPAN CLASS="emph01">*</SPAN> Your City:
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_cy"
                            VALUE="#gb_entry_cy#"
                            SIZE="30">
                      <P>
                      <SPAN CLASS="emph01">*</SPAN> Your State:
                      <INPUT
                            TYPE="text"
                            NAME="gb_entry_stt"
                            VALUE="#gb_entry_stt#"
                            SIZE="30">
                      <BR>
                            <B>Instruments Played:</B>
                      <BR>
                            <TEXTAREA
                                  COLS="45"
                                  MAX="50"

  • Not comitting database after the update query in jdbc

    Hi all,
    This is the first time I am posting this. I have query excuting on racle DB. This is update query. after executing the i have called commint using con.commit(). But still it is not showing the modifications in oracle db.
    What could be went wrong? Any sugestion, please let me know. I think it is simple jdbc program. So i don't think i need to post the code. Application running in Unix machine.
    Regards & thanks,
    Nirmala Vijaya Sekhar Varre

    VijayTechM wrote:
    Connection con = null;
    Class.forName("oracle.jdbc.driver.OracleDriver");          
    hi all,
    // following is the code
    con = DriverManager.getConnection("jdbc:oracle:thin:@10.129.239.43:1529:PBILLING","BILLING","BILLING");
    boolean test = con.getAutoCommit(); //here I am getting 'true'
    String invoice_header_query = "update invoice_header set file_traffico = '" + zipFileName + "' where bill_ref_no = '" + billRefNo_ + "' and bill_ref_resets = '" + billRefResets_ + "' and arbor_instance_id = '" + arborID_ + "'";
    System.out.println("invoice_header_query---->"+invoice_header_query);
    smt = con.createStatement();
    int x = stmt.executeUpdate(query); // Here x = 1 printing so it is updating the one record
    // con.commit(); // Even I have tried call this method. But this will be useful when you are using the Transactioon.
    Could you please tell me what went write. I am using ojdbc14.jar.
    regards,
    VijayPost with code tags and where is your claimed exception handling?

  • Update query in jdo

    I am looking for update query in KODO 4.0. How can I use named query to update "all Companies with number fo employers less then 10" ?
    I seen kodo.query.Query::updateAll method but not able to get an instance of it, because it seems to be reserved for jpa interfaces only...
    any idea ?
    regards
    Andre Teshler

    Hi have found the way to issue update query:
    String queryString =
                   "update buying.changetrackingexportentry " +
                   " set id_confirmedstate = " + state.getId() +
                   " where id_confirmedstate = " + state.getId()
                   +
                   " and id_changeexportregistration in" +
                   " (select id from buying.changeexportregistration where id_externalprocess=" + exportId + ")"
    Query query = (Query)getJdoTemplate().execute(new QueryCallback(queryString));
    ((kodo.jdo.QueryImpl)query).updatePersistentAll(params);
    Unfortunately at runtime this results in:
    <2|false|4.0.0> kodo.jdo.DataStoreException: ORA-00900: Ungültige SQL-Anweisung
         at kodo.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4092)
         at kodo.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:82)
         at kodo.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:66)
         at kodo.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:46)
         at kodo.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeQuery(SQLStoreQuery.java:253)
         at kodo.kernel.QueryImpl.execute(QueryImpl.java:1132)
         at kodo.kernel.QueryImpl.updateInMemory(QueryImpl.java:1263)
         at kodo.kernel.AbstractStoreQuery$AbstractExecutor.executeUpdate(AbstractStoreQuery.java:157)
         at kodo.kernel.AbstractStoreQuery$AbstractExecutor.executeUpdate(AbstractStoreQuery.java:163)
         at kodo.kernel.QueryImpl.update(QueryImpl.java:1240)
         at kodo.kernel.QueryImpl.execute(QueryImpl.java:957)
         at kodo.kernel.QueryImpl.updateAll(QueryImpl.java:1012)
         at kodo.kernel.DelegatingQuery.updateAll(DelegatingQuery.java:865)
         at kodo.jdo.QueryImpl.updatePersistentAll(QueryImpl.java:815)
         at com.ottogroup.buying.infrastructure.dao.masterdatachange.jdo.ChangeTrackingExportEntryRepositoryDaoJdoImpl.updateConfirmedStateToExportedByConfirmedStateAndExportId(ChangeTrackingExportEntryRepositoryDaoJdoImpl.java:133)
         at com.ottogroup.buying.sharedkernel.object.masterdatachange.changeexport.ChangeTrackingExportEntryRepositoryImpl.updateConfirmedStateToExportedByConfirmedStateAndExportId(ChangeTrackingExportEntryRepositoryImpl.java:78)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
         at $Proxy161.updateConfirmedStateToExportedByConfirmedStateAndExportId(Unknown Source)
         at com.ottogroup.buying.sharedkernel.service.changeexport.ChangeExportServiceImpl.export(ChangeExportServiceImpl.java:177)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
         at com.ottogroup.buying.sharedkernel.object.base.error.AopMessageHandler.invoke(AopMessageHandler.java:38)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
         at $Proxy168.export(Unknown Source)
         at test.ottogroup.sharedkernel.object.persistence.base.ChangeExportTest.export(ChangeExportTest.java:146)
         at test.ottogroup.sharedkernel.object.persistence.base.ChangeExportTest.testAll(ChangeExportTest.java:158)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    NestedThrowablesStackTrace:
    java.sql.SQLException: ORA-00900: Ungültige SQL-Anweisung
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
         at oracle.jdbc.driver.T4C8Odscrarr.receive(T4C8Odscrarr.java:214)
         at oracle.jdbc.driver.T4CCallableStatement.doDescribe(T4CCallableStatement.java:731)
         at oracle.jdbc.driver.OracleStatement.describe(OracleStatement.java:3458)
         at oracle.jdbc.driver.OracleResultSetMetaData.<init>(OracleResultSetMetaData.java:57)
         at oracle.jdbc.driver.OracleResultSetImpl.getMetaData(OracleResultSetImpl.java:138)
         at com.solarmetric.jdbc.DelegatingResultSet.getMetaData(DelegatingResultSet.java:363)
         at kodo.jdbc.kernel.SQLProjectionResultObjectProvider.<init>(SQLProjectionResultObjectProvider.java:43)
         at kodo.jdbc.kernel.SQLStoreQuery$SQLExecutor.executeQuery(SQLStoreQuery.java:245)
         at kodo.kernel.QueryImpl.execute(QueryImpl.java:1132)
         at kodo.kernel.QueryImpl.updateInMemory(QueryImpl.java:1263)
         at kodo.kernel.AbstractStoreQuery$AbstractExecutor.executeUpdate(AbstractStoreQuery.java:157)
         at kodo.kernel.AbstractStoreQuery$AbstractExecutor.executeUpdate(AbstractStoreQuery.java:163)
         at kodo.kernel.QueryImpl.update(QueryImpl.java:1240)
         at kodo.kernel.QueryImpl.execute(QueryImpl.java:957)
         at kodo.kernel.QueryImpl.updateAll(QueryImpl.java:1012)
         at kodo.kernel.DelegatingQuery.updateAll(DelegatingQuery.java:865)
         at kodo.jdo.QueryImpl.updatePersistentAll(QueryImpl.java:815)
         at com.ottogroup.buying.infrastructure.dao.masterdatachange.jdo.ChangeTrackingExportEntryRepositoryDaoJdoImpl.updateConfirmedStateToExportedByConfirmedStateAndExportId(ChangeTrackingExportEntryRepositoryDaoJdoImpl.java:133)
         at com.ottogroup.buying.sharedkernel.object.masterdatachange.changeexport.ChangeTrackingExportEntryRepositoryImpl.updateConfirmedStateToExportedByConfirmedStateAndExportId(ChangeTrackingExportEntryRepositoryImpl.java:78)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
         at $Proxy161.updateConfirmedStateToExportedByConfirmedStateAndExportId(Unknown Source)
         at com.ottogroup.buying.sharedkernel.service.changeexport.ChangeExportServiceImpl.export(ChangeExportServiceImpl.java:177)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
         at com.ottogroup.buying.sharedkernel.object.base.error.AopMessageHandler.invoke(AopMessageHandler.java:38)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
         at $Proxy168.export(Unknown Source)
         at test.ottogroup.sharedkernel.object.persistence.base.ChangeExportTest.export(ChangeExportTest.java:146)
         at test.ottogroup.sharedkernel.object.persistence.base.ChangeExportTest.testAll(ChangeExportTest.java:158)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Can someone post an example how to use updatePersistentAll() ?
    thanks
    Andre Teshler

  • Update query got stuck

    Hi, i am creating an update query, i know I had problem before, but when i use this method, it works in one of the pages. Now i am having problem again. Don't know why. Here are the 2 methods i used, both failed.
    method 1:
    String sqltextupdate = "UPDATE BYDATA SET b=?, note=?, l_amt=? WHERE DATAID= 500";
    Statement stmt = conn.createStatement();
    PreparedStatement ps = conn.prepareStatement(sqltextupdate);
    ps.setDouble(1, b_amt);
    ps.setString(2, notes);
    ps.setDouble(3, ls_amt);
    ps.executeUpdate();
    Method 2:
    String sqltextupdate = "UPDATE BYDATA SET b="+b_amt+", note='"+notes+"', l_amt="+ls_amt+" WHERE DATAID=500"
    Statement stmt = conn.createStatement();
    stmt.executeUpdate(sqltextupdate);
    Please help!!
    Thank you!

    Never mind!
    My error: a primary key is create for the table bydata, and the problem is solved.

  • If statement in update query

    I was wondering if you could have a cfif statement inside of a update query.  See example below.  Is there a better way of doing it? thanks.
    <cfquery DATASOURCE="xxx" name="update">
      UPDATE plant_gen_info
            SET levels_complete = #URL.var0#
                <cfif IsDefined("URLvar13">
                ,Q1_answer = #URL.var13#
                </cfif>
            WHERE ID = #session.member_id#
      </cfquery>

    TheScarecrow,
    Yes, dynamic query statements can be assembled using <cfif>.  I would suggest you switch your IsDefined() to a StructKeyExists() and strongly suggest you make good use of <cfqueryparam>:
    <cfquery DATASOURCE="xxx" name="update">
      UPDATE plant_gen_info
            SET levels_complete = <cfqueryparam value="#URL.var0#" cfsqltype="****">
                <cfif StructKeyExists(URL, "var13")>
                ,Q1_answer = <cfqueryparam value="#URL.var13#" cfsqltype="****">
                </cfif>
            WHERE ID = <cfqueryparam value="#session.member_id#" cfsqltype="****">
      </cfquery>
    I put a "****" placeholder for cfsqltype attributes because I'm not sure which would be appropriate for your variables.  See the help docs for more on the cfqueryparam and cfsqltype.
    -Carl V.

  • Insert and update query to calculate the opening and closing balance

    create table purchase(productid number(5) ,dateofpurchase date,
    qty number(5));
    create table inventory(invid number(5),productid number(5),
    idate date,openingqty number(5),closingqty number(5));
    Records in inventory:
    1,1,'01-jan-2009', 10, 20
    2,1,'03-jan-2009', 20, 30
    3,1,'04-jan-2009', 40, 50
    when I enter the purchase invoice for 15 qty on 02-jan-2009
    after say '15-jan-09' , a new record should get inserted
    with opening balance = (closing balance before 02-jan-2009)
    and all the opening and closing balance for that product should
    get affected.
    If the invoice for 20 qty is entered for the existing date say
    '03-jan-2009' in inventory , then the closing balance
    for 03-jan-2009 should get updated and all the following records
    should get affected.
    I need the insert for the first one and update query for the
    second one.
    Vinodh

    <strike>You can do this in one statement by using the merge statement</strike>
    Hmm, maybe I spoke too soon.
    Edited by: Boneist on 25-Sep-2009 13:56
    Thinking about it, why do you want to design your system like this?
    Why not simply have your purchases table hold the required information and then either work out the inventory on the fly, or have a job that calls a procedure to add a row for the previous day?
    If you continue with this design, you're opening yourself up to a world of pain - what happens when the data doesn't match the purchases table? Also when is the inventory cut-off to reset the opening/closing balances? Monthly? Annually? Weekly? If it's set to one of those, what happens when the business request the inventory for a particular week?
    Edited by: Boneist on 25-Sep-2009 13:59

  • If then else in update query

    Hello,
    I was hoping anyone could provide ideas on the best way to do an update query based on an if then else statement I am using Oracle 11 on a linux server. I am writing within a perl script. I've researched online and saw some examples using case. Below is the basic query logic I am trying to implement. I would really appreciate any suggestions.
    Thanks,
    JC
    If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') and askme_temp.CKT_ID = heci.CKT_ID then SUBPRODUCT =’IPAG’
    ELSE If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') AND REGION=’SE’ then SUBPRODUCT =’METRO_E’
    ELSE If the MAINT_CENTER IN ('ENOC1CENTER','PMCTGAAHSDC','ATTCSPCRT01','ATTCSPCWS01','NTNLWHS4NSA') AND CAC1=’S’ and substring(CKT_ID,4,2) IN ('KQ','KR','KS','KP','L1','L2','L3','VL') then SUBPRODUCT =’OPT_E_MAN’

    Hi,
    Welcome to the forum!
    CASE sounds like a good idea to me.
    For example:
    UPDATE     table_x
    SET     subproduct = CASE
                   WHEN  askme_temp.CKT_ID = heci.CKT_ID
                         THEN  'IPAG'
                   WHEN  region          = 'SE'
                         THEN  'METRO_E'
                         ELSE  'OPT_E_MAN'
                   END
    WHERE     maint_center     IN ( 'ENOC1CENTER'
                      , 'PMCTGAAHSDC'
                      , 'ATTCSPCRT01'
                      , 'ATTCSPCWS01'
                      , 'NTNLWHS4NSA'
    AND   cac1                  = 'S'
    AND   SUBST (ckt_id, 4, 2)  IN ('KQ', 'KR', 'KS', 'KP', 'L1', 'L2', 'L3', 'VL')
    AND   ...
    ;CASE expressions are evaluated in the order in which you write them, so if askme_temp.ckt_id = heci.ckt_id (whatever those things are), subproduct will be set to 'IPAG'. It won't matter whether region is 'METRO_E' or not; if the 1st condition is TRUE, the first THEN value is returned, and the other WHEN expressions aren't even evaluated.
    What do you want to do if none of those conditions are met?
    Any conditions that are common to all the rows being UPDATEd can be put in the WHERE clause; they don't have to be repeated in the CASE expression.
    Remember, MERGE is often more convenient to use than UPDATE.
    Edited by: Frank Kulash on Jul 27, 2011 3:23 PM

  • About update query

    Hello :),
    I am a MS SQL Server expert [;)]. trying to learn ORACLE.
    I tried to assign some value to a variable in an update query. I got error message that virtual columns are not allowed. This is very important to get rolling effect.
    Can some one please guide me about how to get rolling effect if we can not assign a value to a variable in an update query.
    Thanx in advance.
    Nishu

    hello sgalaxy and gintsp, thanx for ur reply.
    My reply is so late because for some reason I was not able to log on to this site.
    There is some good reason why I need this. I am giving code and error messages below, please guide me.
    ==============================
    I am trying this thing in procedure. I am using ORACLE DATABASE EXPRESS EDITION
    Here is the code.
    create or replace procedure "PROC1"
    is
    TYPE Bal_Collect IS TABLE OF NUMBER;
    Collt Bal_Collect := Bal_Collect(100);
    begin
    Update empAccount Set Bal = Collt(Collt.Last) Returning Bal BULK COLLECT INTO Collt;
    end;
    Error message
    Compilation failed,line 6 (02:20:45)
    PLS-00425: in SQL, function argument and return types must be SQL type
    Compilation failed,line 6 (02:20:45)
    PL/SQL: ORA-00904: : invalid identifier
    Compilation failed,line 6 (02:20:45)
    PL/SQL: SQL Statement ignored
    BUT FOLLOWING UPDATE STATEMENT WORKS
    Update empAccount Set Bal = Collt(1) Returning Bal BULK COLLECT INTO Collt;

  • Sender jdbc adapter - no update query

    hi ,
    i am using pi 731 single stack.
    the scenario is - PI has to pick data from view of a hana database. i am using jdbc sender for it.
    pi will not have access to update the table,only pi can read the view of database.So,PI can't use UPDATE query.
    If in jdbc sender channel ,I use SELECT query only and no UPDATE query - will it work ? what will happen if there are 100 records in the view and PI failed after fetching 43 records..will it pick from 44th record next time OR it will start from 0 again ?
    rgds

    Hi SAP PI,
    It has no sense to use the sender JDBC without update query because then always will be taken the same records.
    If you cant update the source DB you only have the choice to talk with the DB administrators that they develop for you a stored procedure that it has to do the work to get different records in every PI access.
    If the PI record process fail with impossible source database update update, the only way (afaik) is to do a PI alert and to communicate it to db sender administrators. There are another option like to store the data in a intermediate table, and so on but all possibilities that i can think now are not to enough good.
    Regards.

  • Update query not working in the JDBC sender Communication channel

    Hi,
    We are working on JDBC to File scenario. As per the configuration, XI should pick the data from SQL database every 20 secs and should update the corresponding flag. We are using subquery in the select and update statement as both header and detail tables are involved.
    Now the issue is, select query is working fine but update statement is not working as expected. It is somehow updating some other records rather than doing for the ones selected by the adapter.
    Moreover logSQLstatement is also not working. Hence we are unable to identify the records which are getting updated.
    Please advise.

    Hi Rumi,
    See Question 8. Transaction Handling (Sender) in [SAP Note 831162 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 JDBC Adapter|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=831162].
    8.  Transaction Handling (Sender)
    Q: If I have the following configured in a JDBC Sender:
    Select Query:
    SELECT column FROM TABLENAME WHERE FLAG = "TRUE"
    Update Query:
    UPDATE TABLENAME SET FLAG = "FALSE" WHERE FLAG = "TRUE"
    How do I know that the JDBC adapter will not update newly added rows (rows that were
    added between the time that the SELECT and UPDATE queries were executed) that were
    not read in the initial SELECT query?
    A: The SELECT and the UPDATE are run in the same DB transaction, i.e. both statements
    have the same view on the database.
    Make sure that both statements use the same WHERE clause. An additional
    requirement for the correct operation of this scenario is the configuration of
    an appropriate transaction isolation level on the database
    (i.e., repeatable_read or serializable). You might also consider using a
    "SELECT FOR UPDATE" statement instead of a plain SELECT statement to
    ensure proper locking on the database. "SELECT FOR UPDATE"
    is not supported in MS SQL database. In this case please make use of an
    appropriate transaction isolation level on the database. For more details
    please contact your DB vendors.
    After, see Transaction Handling Issues in [SAP Note 1039779 - JDBC Adapter issues(Escape character,Transaction handling)|https://websmp130.sap-ag.de/sap(bD1wdCZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1039779].
    Best Regards.
    Pedro Baroni

  • How to use xs:date() in an update query?

    I cannot test xs:date attributes in an "update" query. In a "select" query, all work fine.
    This is the sample schema:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
    <xs:schema xmlns:tns="http://OracleTest" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" targetNamespace="http://OracleTest" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:complexType name="MyComplexType">
    <xs:sequence>
    <xs:element minOccurs="0" name="FirstChild">
    <xs:complexType>
    <xs:attribute name="A" type="xs:string" />
    <xs:attribute name="B" type="xs:string" />
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    <xs:attribute name="ID" type="xs:string" />
    <xs:attribute name="DateAttr" type="xs:date" />
    </xs:complexType>
    <xs:element xdb:defaultTable="MyElement" name="MyElement" type="tns:MyComplexType" />
    </xs:schema>
    This is a sample XML document:
    <?xml version="1.0" encoding="utf-8"?>
    <!-- Created with Liquid XML Studio 1.0.8.0 (http://www.liquid-technologies.com) -->
    <tns:MyElement ID="ID1" xmlns:tns="http://OracleTest" DateAttr="2008-03-14" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://OracleTest http://OracleTest.xsd">
    <tns:FirstChild A="a" B="b" />
    </tns:MyElement>
    If I check the DateAttr attribute in a xquery, it works fine:
    select xmlquery('declare default element namespace "http://OracleTest"; collection("/Testing")/MyElement[@DateAttr=xs:date(''2008-03-14'')]' returning content).getclobval() from dual
    If I execute an update, like this:
    UPDATE RESOURCE_VIEW SET RES = deleteXML(RES, '/oraxdbr:Resource/oraxdbr:Contents/Testing/MyElement[@DateAttr=xs:date(''2008-03-14'')]','xmlns:oraxdbr="http://xmlns.oracle.com/xdb/XDBResource.xsd" xmlns="http://OracleTest"')
    WHERE equals_path(RES, '/Testing/test1.xml') = 1
    I get the error:
    SQL Error: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00607: Invalid reference: 'date'.
    31011. 00000 - "XML parsing failed"
    Where is the problem?
    Thank you!
    Mirko

    Hi,
    Correct me if I'm wrong, but didn't xs:date() came with xpath 2.0?
    deleteXML supports xpath 1.0 .
    XMLQuery supports xpath 2.0.
    That's why the error "Invalid reference: 'date'".
    what function supports which version read Re: Which version of XPathAnts

  • Why update query takes  long time ?

    Hello everyone;
    My update query takes long time.  In  emp  ( self testing) just  having 2 records.
    when i issue update query , it takes long time;
    SQL> select  *  from  emp;
      EID  ENAME     EQUAL     ESALARY     ECITY    EPERK       ECONTACT_NO
          2   rose              mca                  22000   calacutta                   9999999999
          1   sona             msc                  17280    pune                          9999999999
    Elapsed: 00:00:00.05
    SQL> update emp set esalary=12000 where eid='1';
    update emp set esalary=12000 where eid='1'
    * ERROR at line 1:
    ORA-01013: user requested cancel of current operation
    Elapsed: 00:01:11.72
    SQL> update emp set esalary=15000;
    update emp set esalary=15000
      * ERROR at line 1:
    ORA-01013: user requested cancel of current operation
    Elapsed: 00:02:22.27

    Hi  BCV;
    Thanks for your reply but it doesn't provide output,  please  see   this.
    SQL> update emp set esalary=15000;
    ........... Lock already occured.
    >> trying to trace  >>
    SQL> select HOLDING_SESSION from dba_blockers;
    HOLDING_SESSION
                144
    SQL> select sid , username, event from v$session where username='HR';
    SID USERNAME     EVENT
       144   HR    SQL*Net message from client
       151   HR    enq: TX - row lock contention
       159   HR    SQL*Net message from client
    >> It  does n 't  provide  clear output about  transaction lock >>
    SQL> SELECT username, v$lock.SID, TRUNC (id1 / POWER (2, 16)) rbs,
      2  BITAND (id1, TO_NUMBER ('ffff', 'xxxx')) + 0 slot, id2 seq, lmode,
      3  request
      4  FROM v$lock, v$session
      5  WHERE v$lock.TYPE = 'TX'
      6  AND v$lock.SID = v$session.SID
      7  AND v$session.username = USER;
      no rows selected
    SQL> select MACHINE from v$session where sid = :sid;
    SP2-0552: Bind variable "SID" not declared.

Maybe you are looking for