473,883 Members | 1,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rowlock in insert query

Hello All,
I am new to DB2,
Currently i am using DB2 version 8.02 personal edition on Windows XP
Professional.
And Facing problem with rowlock in insert query.

I have created a sample database as

CREATE TABLE SCEMANAME.LOG (
Sequence DECIMAL(9 ,0) NOT NULL ,
SubSequence DECIMAL(9 ,0) NOT NULL ,
RecordType DECIMAL(9 ,0) ,
LogDate TIMESTAMP ,
Name char (30) ,
Action char (80) ,
usertype DECIMAL(1) ,
sourceapp DECIMAL(1)
)

And now trying to fire queries on DB2

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSE QUENCE,RECORDTY PE,LOGDATE,
NAME,ACTION,USE RTYPE,SOURCEAPP )
VALUES(1,12,123 ,'2007-04-03 15:51:47.333',' SANS','test',0, 0);
but the query results in an error as ,

DB21034E The command was processed as an SQL statement because it was
not a
valid Command Line Processor command. During SQL processing it
returned:
SQL0104N An unexpected token "WITH" was found following "RT INTO
SCEMANAME.LOG". Expected tokens may include: "<space>".
SQLSTATE=42601

SQL0104N An unexpected token "WITH" was found following "RT INTO
SHELKESA.LOG". Expected tokens may include:
"<space ".
can anyone help me to solve this issue.

Apr 5 '07 #1
8 9417
Santy wrote:
Hello All,
I am new to DB2,
Currently i am using DB2 version 8.02 personal edition on Windows XP
Professional.
And Facing problem with rowlock in insert query.

I have created a sample database as

CREATE TABLE SCEMANAME.LOG (
Sequence DECIMAL(9 ,0) NOT NULL ,
SubSequence DECIMAL(9 ,0) NOT NULL ,
RecordType DECIMAL(9 ,0) ,
LogDate TIMESTAMP ,
Name char (30) ,
Action char (80) ,
usertype DECIMAL(1) ,
sourceapp DECIMAL(1)
)

And now trying to fire queries on DB2

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSE QUENCE,RECORDTY PE,LOGDATE,
NAME,ACTION,USE RTYPE,SOURCEAPP )
VALUES(1,12,123 ,'2007-04-03 15:51:47.333',' SANS','test',0, 0);
That's invalid syntax. There is no "WITH(...)" clause available where you
want to use it.

http://publib.boulder.ibm.com/infoce...c/r0000970.htm

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 5 '07 #2
Can you please suggest me required changes so that the query will runs
fine

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSE QUENCE,RECORDTY PE,LOGDATE,
NAME,ACTION,USE RTYPE,SOURCEAPP )
VALUES(1,12,123 ,'2007-04-03 15:51:47.333',' SANS','test',0, 0);

Thanks,
Santosh Shelke

Apr 5 '07 #3
Santy wrote:
Can you please suggest me required changes so that the query will runs
fine

INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSE QUENCE,RECORDTY PE,LOGDATE,
NAME,ACTION,USE RTYPE,SOURCEAPP )
VALUES(1,12,123 ,'2007-04-03 15:51:47.333',' SANS','test',0, 0);
Follow the syntax diagram.

Hint: Simply remove the "WITH (ROWLOCK)"

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 5 '07 #4
On Apr 5, 3:31 pm, Knut Stolze <sto...@de.ibm. comwrote:
Santy wrote:
Can you please suggest me required changes so that the query will runs
fine
INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSE QUENCE,RECORDTY PE,LOGDATE,
NAME,ACTION,USE RTYPE,SOURCEAPP )
VALUES(1,12,123 ,'2007-04-03 15:51:47.333',' SANS','test',0, 0);

Follow the syntax diagram.

Hint: Simply remove the "WITH (ROWLOCK)"

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany

Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.
Apr 5 '07 #5
Santy wrote:
[...]
Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.

What do you want to lock while writing? The row you are inserting?

Apr 5 '07 #6
On Apr 5, 4:20 pm, Lennart <erik.lennart.j ons...@gmail.co mwrote:
Santy wrote:

[...]
Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.

What do you want to lock while writing? The row you are inserting?

yes by ROWLOCK we mean the same.

Apr 5 '07 #7
"Santy" <sh*********@gm ail.comwrote in message
news:11******** **************@ y80g2000hsf.goo glegroups.com.. .
yes by ROWLOCK we mean the same.
DB2 will automatically lock (exclusive) the row you have inserted until you
do a commit. You should remove any explicit locking commands..
Apr 5 '07 #8
Santy wrote:
On Apr 5, 3:31 pm, Knut Stolze <sto...@de.ibm. comwrote:
>Santy wrote:
Can you please suggest me required changes so that the query will runs
fine
INSERT INTO SCEMANAME.LOG WITH (ROWLOCK)
(SEQUENCE,SUBSE QUENCE,RECORDTY PE,LOGDATE,
NAME,ACTION,USE RTYPE,SOURCEAPP )
VALUES(1,12,123 ,'2007-04-03 15:51:47.333',' SANS','test',0, 0);

Follow the syntax diagram.

Hint: Simply remove the "WITH (ROWLOCK)"

Thanks For the reply...
But We have to add a locking while inserting data in the table ,
in that case which are the options available.
DB2 automatically locks newly inserted rows and does not force the
application to worry about such details.

If you want to have another locking granularity, you could use the LOCK
TABLE statement to lock the whole table.

--
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany
Apr 10 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1916
by: avinash | last post by:
hello myself avinash i am developing on application having vb 6 as front end and sql server 7 as back end. when i use insert query to insert data in table then the date value of that query is going as 01/01/1900 my query is as follows StrSql = "Insert Into SalesVoucher(TransactionID,VoucherNo,VoucherDate,DebitTo,CreditTo,TotalAmt,Discount,ModAmt,ModWt,Other,Othertype,TaxPerc,TaxAmt,NetAmt,Advance,Narration,Haste)" StrSql = StrSql & "...
8
6305
by: Carl | last post by:
Hi, I hope someone can share some of their professional advice and help me out with my embarissing problem concerning an Access INSERT query. I have never attempted to create a table with one-to-one relationship but on this occasion I must keep username/password details within a seperate table. Here's the basic specs and database schema: -------------------------------------------
5
15425
by: Annie | last post by:
hello guys, I have little experience working with C# and MS Access ... I am having an insert query with one datetime field and a boolean and couple of text and number fields as below: "Insert into order (OrderClientID, OrderDate, OrderOfferID, OrderIsSpecial, OrderShipment) Values (6, # 16/09/2005 2:38:51 PM # , 1 , 0 , 'hello there it is test')"
0
1295
by: clickon | last post by:
I want to use an INSERT Query as the value for the UpdateCommand property of an SQL datasource, anyone know if this will actually work ? The reason i want to do it is bacause i am taking values from tablea and binding them to controls, whose values i want to insert into tableb. I am using a detailsview control to do the databinding. If the detailsview is in edit mode then it displays the data from table A in the bound testbox controls...
1
6216
by: abhi81 | last post by:
Hello All, I have a table on which I have created a insert,Update and a Delete trigger. All these triggers write a entry to another audit table with the unique key for each table and the timestamp. Insert and Update trigger work fine when i have only one of them defined. However when I have all the 3 triggers in place and when i try to fire a insert query on the statement. It triggers both insert and update trigger at the same time and...
0
463
by: Santy | last post by:
Hello All, I am new to DB2, Currently i am using DB2 version 8.02 personal edition on Windows XP Professional. And Facing problem with rowlock in insert query. I have created a sample database as CREATE TABLE SCEMANAME.LOG ( Sequence DECIMAL(9 ,0) NOT NULL ,
1
2771
by: Luqman | last post by:
I have created a Insert Query in Sql Data Source using Oracle Database, with the parameters, and its connected with DetailView Control. When I try to Insert through DetailView Control, Illegal Variable Name/Number Error occurs. Is there any way I can trace or display on screen, what exactly the query is being passed to the Oracle with the Values. For example: If my Sql datasource has following query.
0
2294
by: magnolia | last post by:
i created a trigger that will record the changes made to a table .everything works fine except the insert query.whenerever i try to insert a record it fires insert and update triger at the same time which means i hav 2 record for every insert operation. any help appreciated. thank u herez teh code i tried. ALTER TRIGGER trg_ContactAddress_Audit ON Address FOR DELETE, INSERT, UPDATE AS
1
2067
by: Marco van der M | last post by:
Hello everyone, I am trying to make an insert query that inserts information using form values and a query that gets the id from the name of a field in the form. I got a form that shows object name, date completed and department completed. I am trying to do the following: INSERT INTO DB (Person_id, Object_id, Date_completed, Department_completed) Values (Forms!Form1!Person_id, Querydata, Forms!Form2!Date_completed,...
0
9933
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9781
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11121
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10836
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9564
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5793
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5982
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4606
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4210
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.