473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,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 9374
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,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,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,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,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,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,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,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,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.jons...@gmail.comwrote:
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*********@gmail.comwrote in message
news:11**********************@y80g2000hsf.googlegr oups.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,SUBSEQUENCE,RECORDTYPE,LOGDATE,
NAME,ACTION,USERTYPE,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
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...
8
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...
5
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: ...
0
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...
1
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....
0
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...
1
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...
0
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.