473,585 Members | 2,513 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 9399
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
1903
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...
8
6280
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
15405
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...
0
1279
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...
1
6196
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...
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
2753
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...
0
2279
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...
1
2056
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,...
0
7908
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...
0
7836
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...
0
8199
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. ...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
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...
0
8212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3835
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...
1
2343
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
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.