Error in update query involving different databases
Hi everybody,
I get the error "ORA : 00933 SQL Command not properly ended"
when I try to execute the following query, in oracle8i. Also the tables it involves are from different db. I tried to put @server_name after the table name but still it didn't work:
UPDATE ASAP.CAP_NW_CONN_DUMP cncd
SET MS_INIT = ep1.task_status, HANDSET_DEL = ep3.task_status,
ACTIVATION = ep.task_status, MS_UPDT = ep2.task_status,
MS_FNL = ep4.task_status
ep1.task_status, ep3.task_status, ep.task_status, ep2.task_status, ep4.task_status
FROM eposmig.t_intf_order_task_dtls@eposload ep, eposmig.t_intf_order_task_dtls ep1, eposmig.t_intf_order_task_dtls ep2,
eposmig.t_intf_order_task_dtls ep3, eposmig.t_intf_order_task_dtls ep4,
eposmig.pos_order_lines@eposload pol
WHERE cncd.ident_text = pol.telephone_no
AND ep.task_type LIKE 'ACT%'
AND ep1.task_TYPE = 'MSOLV-INIT'
AND ep2.task_TYPE = 'MSOLV-UPDATE'
AND ep3.task_type = 'MSOLV-FINAL'
AND ep4.task_type = 'HANDSET-DEL'
AND ep.ORDER_NBR = pol.ORDER_NBR
AND ep1.ORDER_NBR = pol.ORDER_NBR
AND ep2.ORDER_NBR = pol.ORDER_NBR
AND ep3.ORDER_NBR = pol.ORDER_NBR
AND ep4.ORDER_NBR = pol.ORDER_NBR
AND pol.order_line_nbr IN (SELECT MAX(order_line_nbr) FROM eposmig.pos_order_lines
WHERE telephone_no IN (SELECT ident_text FROM asap.cap_nw_conn_dump)
GROUP BY telephone_no)
The table that is being updated, is in same db, but rest of two tables are from different databases i.e eposload
>
UPDATE ASAP.CAP_NW_CONN_DUMP cncd
SET MS_INIT = ep1.task_status, HANDSET_DEL =
EL = ep3.task_status,
ACTIVATION = ep.task_status, MS_UPDT =
DT = ep2.task_status,
MS_FNL = ep4.task_status
ep1.task_status, ep3.task_status, ep.task_status,
ep2.task_status, ep4.task_status
FROM eposmig.t_intf_order_task_dtls@eposload ep,
eposmig.t_intf_order_task_dtls ep1,
eposmig.t_intf_order_task_dtls ep2,
eposmig.t_intf_order_task_dtls ep3,
3, eposmig.t_intf_order_task_dtls ep4,
eposmig.pos_order_lines@eposload pol
WHERE cncd.ident_text = pol.telephone_no
AND ep.task_type LIKE 'ACT%'
AND ep1.task_TYPE = 'MSOLV-INIT'
AND ep2.task_TYPE = 'MSOLV-UPDATE'
AND ep3.task_type = 'MSOLV-FINAL'
AND ep4.task_type = 'HANDSET-DEL'
AND ep.ORDER_NBR = pol.ORDER_NBR
AND ep1.ORDER_NBR = pol.ORDER_NBR
AND ep2.ORDER_NBR = pol.ORDER_NBR
AND ep3.ORDER_NBR = pol.ORDER_NBR
AND ep4.ORDER_NBR = pol.ORDER_NBR
AND pol.order_line_nbr IN (SELECT MAX(order_line_nbr)
FROM eposmig.pos_order_lines
WHERE telephone_no IN (SELECT
e_no IN (SELECT ident_text FROM
asap.cap_nw_conn_dump)
GROUP BY telephone_no)
The syntax of your UPDATE statement is incorrect.
Have a look at the "wire-diagram" in the documentation -
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10007.htm#SQLRF01708
and compare it with your UPDATE statement.
HTH
isotope
Similar Messages
-
Error in updating/inserting task in database
When I pass in a runtimeFault Code, Detail and Summary into Flexstring1,2,3 I am getting this runtime error :
Error in updating/inserting task in database. SQL Exception while updating/inserting task into the database. Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
Where can I find the error stack?
Peteturn the following loggers from info to debug level (bpel console/manage domain/ tab logging)
default.collaxa.cube.ws and
default.oracle.services
given you are using a developer isntall, you should see the stack a dos box
if you are using an application server mid tier cou can find them in $AS_HOME/opmn/logs/OraOc4J_BPELxxxx.log
hth clemens -
Trying to get a list of fragmented indexes based on a database name. However,
SELECT COUNT(*) AS TableFragOver80PctCount
FROM sys.dm_db_index_physical_stats (null, null, null, null, null )as ts
INNER JOIN sys.tables t on t.[object_id] = ts.[object_id]
INNER JOIN sys.indexes i on i.[object_id] = ts.[object_id]
INNER JOIN sys.databases db ON ts.database_id = db.database_id
WHERE db.name = 'MY DB NAME'
AND ts.avg_fragmentation_in_percent > 80.00
The error I get back
Msg 942, Level 14, State 4, Line 1
Database 'VERY DIFFERENT DB' cannot be opened because it is offline.
I know there is a database on this server that is offline, actually 2 or 3, but not the one Im trying to get information about. What could cause the above query to have trouble getting index info that is caused by an entirely different database being
offline?FROM sys.dm_db_index_physical_stats (null, null, null, null, null )as ts
See MSDN sys.dm_db_index_physical_stats
; the first parameter is the database id; if you pass NULL as here, then all databases will be scanned, also your offline one.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
This is my update query in oracle but it is giving error:
Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
from note_master NM ,
( select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc, NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA, (50 * (NORM.Strike_Price_Per/100)) as
rike_Price_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
NORM.Nominal_Amount End )as Nominal_Amount_Calc, (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc from ( select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2 from ( Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
Currency , Strike_Price_Per,Misc2 from Sample_ADF_FinIQ_Common.Note_Order_RM Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN' And RO_ID = 'R000000002' ) NORM Group by Note_Master_Id ) NORM
Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA On RSBA.PairCode = (NORM.Asset ) Left Outer JOIN ( select Note_Master_ID,sum(Nominal_Amount)
as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA from Note_Order_RM
Where RO_ID <> 'R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y' ,
Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc ,
Current_Spot = RESULT1.Spot_Price_Calc , Published_Spot = RESULT1.Spot_Price_Calc , Strike_Price = RESULT1.Strike_Price_Calc
where NM.Note_Master_ID = RESULT1.Note_Master_ID;
error :
rror at Command Line:17 Column:105
Error report:
SQL Error: ORA-00904: "RESULT1"."STRIKE_PRICE_CALC": invalid identifier
00904. 00000 - "%s: invalid identifier"
can anybody help.
ThanksStill one more typo problem exists in you sql stament , equal to(=) operator is missing in your original statement look below
original
Where RO_ID 'R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y'
modified
Where RO_ID='R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y' Ok, once try with this code, some syntax prob i modified it.
Update (select NM.Nominal_Amount,NM.Number_of_Units,NM.Current_Spot,NM.Published_Spot,NM.Strike_Price
from note_master NM ,
( select NORM.Note_Master_ID, NORM.Asset, NORM.Currency , 50 as Spot_Price_Calc, NVL(TOADD.NA,0) As NA, NVL(TOADD.NS,0)
As NS, NVL(TOADD.NA_P,0) As NA_P, NVL(TOADD.NS_P,0) As NS_P, NVL(TOADD.SA,0) As SA, (50 * (NORM.Strike_Price_Per/100)) as
Strike_Price_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100)) Else
NORM.Nominal_Amount End )as Nominal_Amount_Calc, (Case When UPPER(NORM.Misc2) ='N' THEN (NORM.Nominal_Amount /( 50 * (NORM.Strike_Price_Per/100)))
Else NORM.No_Of_Shares End )as NO_Of_Shares_Calc, (Case When UPPER(NORM.Misc2) = 'Q' THEN (NORM.No_Of_Shares * 50 * (NORM.Strike_Price_Per/100) * NORM.Issue_Price )/100
Else (NORM.Nominal_Amount * NORM.Issue_Price )/100 End )as Settlement_Amt_Calc from ( select Note_Master_Id, MIN(Spot_Price) as Spot_Price, Min(Strike_Price) as
Strike_Price, SUM(Nominal_Amount) as Nominal_Amount, SUM(No_Of_Shares) as No_Of_Shares , MIN(Issue_Price) as Issue_Price, MIN(Asset) as Asset, MIN(Currency) as Currency,
MIN(Strike_Price_Per) as Strike_Price_Per, MIN(Misc2) as Misc2 from ( Select Note_Master_Id, Spot_Price, Strike_Price, Nominal_Amount, No_Of_Shares, Issue_Price, Asset,
Currency , Strike_Price_Per,Misc2 from Sample_ADF_FinIQ_Common.Note_Order_RM Where Order_Status_Flag = 'YYYYYYNNNNNNNNNN' And RO_ID = 'R000000002' ) NORM Group by Note_Master_Id ) NORM
Left Outer JOIN Sample_ADF_FinIQ_Common.RATESSPOTBIDASK RSBA On RSBA.PairCode = (NORM.Asset ) Left Outer JOIN ( select Note_Master_ID,sum(Nominal_Amount)
as NA, sum(No_Of_Shares) as NS, sum(NominalAmt_Pending) as NA_P, sum(NoOfShares_Pending) as NS_P,sum(Settlement_Amt) as SA from Note_Order_RM
Where RO_ID 'R000000002' group by Note_Master_ID ) TOADD On TOADD.Note_Master_ID = NORM.Note_Master_ID ) RESULT1 where NM.Note_Master_ID = RESULT1.Note_Master_ID )
set Price_Updated_YN = 'Y' ,
Nominal_Amount = RESULT1.NA + RESULT1.Nominal_Amount_Calc , Number_Of_Units = RESULT1.NS + RESULT1.NO_Of_Shares_Calc ,
Current_Spot = RESULT1.Spot_Price_Calc , Published_Spot = RESULT1.Spot_Price_Calc , Strike_Price = RESULT1.Strike_Price_Calc
where NM.Note_Master_ID = RESULT1.Note_Master_ID;Edited by: darkStargate on Dec 8, 2011 7:42 PM -
Error in update query with join
hi all,
im using oracle 10g in windows.
im not able to use this update query having join......
UPDATE
b
SET
b.is_stud = 1
FROM
boy b
INNER JOIN
relationship r
ON
b.id = r.boy_id;
thanks a lot..................887268 wrote:
hi, thanks,,,,,,,,,
create table emp ( id,name,date,empno);
create table emp_status(slno,ename,empno);
i need to update "emp.name" in "emp" table from "emp_status.ename"
where emp.empno=emp_status.empno;
i.e) for all matched "empno" from both table, update "emp.name" from "emp_status.ename"Whats the relationship between emp and emp_status tables? If there exists one to one mapping for empno in both tables, then try
update emp e
set e.name = (select es.ename
from emp_status es
where e.empno = es.empno) -
Syntax errors in update query with inner joins and sub query.
Below is the query:
UPDATE sp_CFQ_Coord_Corrections
INNER JOIN (CFQ_Coord_Corrections
INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID)
ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID
SET CFQ_Coord_Corrections.MatchFound = 1,
CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID],
sp_CFQ_Coord_Corrections.MatchFound = 1
WHERE (((CFQ_Coord_Corrections.MatchFound)=0)
AND ((sp_CFQ_Coord_Corrections.MatchFound)=0)
AND ((CFQ_Coord_Corrections.RecImported)=1)
AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT')
AND ((CFQ_Referrals.RecCombKey)='No.Match')
AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
Error messages seen when executed:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'INNER'.
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near 'CFQ_Coord_Corrections'.
Please help.....Below is the query:
UPDATE sp_CFQ_Coord_Corrections
INNER JOIN (CFQ_Coord_Corrections
INNER JOIN CFQ_Referrals ON CFQ_Coord_Corrections.CorrID = CFQ_Referrals.RecID)
ON sp_CFQ_Coord_Corrections.ID = CFQ_Referrals.RecID
SET CFQ_Coord_Corrections.MatchFound = 1,
CFQ_Coord_Corrections.RecTblID = [CFQ_Referrals].[RecTblID],
sp_CFQ_Coord_Corrections.MatchFound = 1
WHERE (((CFQ_Coord_Corrections.MatchFound)=0)
AND ((sp_CFQ_Coord_Corrections.MatchFound)=0)
AND ((CFQ_Coord_Corrections.RecImported)=1)
AND ((CFQ_Referrals.RecFileName)='COORDCORR_SPOINT')
AND ((CFQ_Referrals.RecCombKey)='No.Match')
AND ((sp_CFQ_Coord_Corrections.RecImported)=1));
Error messages seen when executed:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'INNER'.
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near 'CFQ_Coord_Corrections'.
Please help.....
sp_CFQ_Coord_Corrections is a table and not a stored procedure.
are these both tables "sp_CFQ_Coord_Corrections" and "CFQ_Coord_Corrections" different ?? -
Hi everybody,
I'm using oracle 8i and get the error as
"ORA:00933 SQL Command not properly ended"
When I try to execute the following query:
UPDATE serv_req_gateway_event
SET serv_req_gateway_event.GATEWAY_EVENT_STATUS_CD = 'S'
FROM TASK
WHERE serv_req_gateway_event.task_number = TASK.task_number
AND serv_req_gateway_event.DOCUMENT_NUMBER = TASK.DOCUMENT_NUMBER
AND TASK.TASK_STATUS IN ('Ready', 'Pending')
AND TASK.document_number IN (145977424,145974024)
Please help me out ...The syntax you have posted is unlike any Oracle update syntax.
Look at the examples in Morgan's Library at www.psoug.org or the docs at http://tahiti.oracle.com.
What does the TASK table have to do with the table you are updating? You can not have a FROM without a SELECT. -
Syntax error in 'UPDATE' query ???
hi..
i know there is something wrong with this query..but not able to find it out.
i am using session bean in my project..in one of the method of the bean class, i am updating 'Acc_holder' table.
below is the code
public String insDeposit(String vuserid, String vaccountno, int amount, int chqno)
... //connection code
Statement stmt=null;
query="UPDATE Acc_holder SET balance=balance" + vamount + "WHERE userid=' "+vuserid+" ' ";
}In above query, Acc_holder Table has balance(int), vamount(int), userid(varchar) fields.
when i run, error msg that i get is "java.rmi.RemoteException...java.sql.SQLException:...Incorrect syntax near 'userid'.
please suggest how this query should be formattedUse a prepared statement.
And after you start doing that then put a space in front of the 'where' -
Need to run the same query on different databases with the same argument
Hi folks,
I've a script: obj, which has simple stuff, when I execute @obj
this asked me for the object_name
and in return gives me object/s if it exists in this (connected) db.
Now to check in 2 other dbs, I've to disconnect from here and then connect to those dbs and run the same @obj there and give the same argument, e.g., EMP and it'll return the answer.
What is desired ... if not very hard on you :-(
Some thing like @objAll
asked only once object_name ... e.g., I gave EMP
now go to all the 3 dbs and give me the result in ONE spool file only.
What do you think, is this tough, I did something, but it was not involved connecting to different dbs, within the same script, but here we cannot create db links and have to disconnect and connect to the db to get some information.
Please do reply, if my question is not understandable or any ...
Thanks in advance.
Best regards.
Edited by: user8604530 on Jun 27, 2012 1:51 PMAs far as i understand from your question : you cannot create db links ? right..
well another option is to create a shell script , something like this :
vi check.sh
export ORACLE_SID=db1
sqlplus / as sysdba <<EOF
select query comes here;
exit;
EOF
export ORACLE_SID=db2
sqlplus / as sysdba <<EOF
select query comes here;
exit;
EOFchmod 777 check.sh
This does the job for you.. I am unsure how to pass the parameters in sql while running through a sheel script.. but if thats possible you will be able to achieve what you want.
Regards
Kk
Edited by: Kk on Jun 27, 2012 2:44 PM -
Below is the query:
UPDATE CFQCC
SET sp_CFQCorr.RecImported = 1,
CFQCC.RecImported = 1
from [HR_DEV_DM].[CFQ_TEST].CFQ_Coord_Corrections as CFQCC
INNER JOIN [HR_DEV_DM].[CFQ_TEST].sp_CFQ_Coord_Corrections as sp_CFQCorr
ON CFQCC.CorrID = sp_CFQCorr.ID
WHERE (((sp_CFQCorr.RecImported)=0)
AND ((CFQCC.RecImported)=0));
When executed, it gives the below error:
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "sp_CFQCorr.RecImported" could not be bound.
Please help....UPDATE Table1, Table2
SET Table1.Column1 = 'one'
,Table2.Column2 = 'two'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = 'id1' -
Help with SQL Query Involving Three Database Tables
Hi,
My SQL is very rusty since I have not touched it in over one year.
I was given an SQL question in a job interview and I am curious to know the right answer.
This was a pre-prepared written test and the interviewer did not know the answer.
There are three database tables: STUDENTS, COURSES and STUDENT_COURSES
Table STUDENTS has STUDENT_ID and STUDENT_NAME columns.
Table COURSES has COURSE_ID and COURSE_DESCRIPTION columns.
Table STUDENT_COURSES has columns STUDENT_ID and COURSE_ID.
Provide a query that returns all the students that are enrolled in all the courses.
Thanks,
Avi.It is probably good to say that this task may be solved such way, if database normalized and there are references
Basically here just is a variant of your solution
DROP TABLE student_course;
DROP TABLE student;
DROP TABLE course;
CREATE TABLE student
(student_id NUMBER(9) PRIMARY KEY,
student_name VARCHAR2(30));
CREATE TABLE course
(course_id NUMBER(9) PRIMARY KEY,
dscr VARCHAR2(100));
CREATE TABLE student_course
(student_id NUMBER(9),
course_id NUMBER(9));
ALTER TABLE student_course
ADD CONSTRAINT pk_st_crs PRIMARY KEY
(student_id, course_id);
ALTER TABLE student_course
ADD CONSTRAINT fk_student
FOREIGN KEY (student_id)
REFERENCES student(student_id);
ALTER TABLE student_course
ADD CONSTRAINT fk_course
FOREIGN KEY (course_id)
REFERENCES course(course_id);
INSERT INTO student
VALUES (1, 'NAME1');
INSERT INTO student
VALUES (2, 'NAME2');
INSERT INTO student
VALUES (3, 'NAME3');
INSERT INTO course
VALUES (101, 'Desc 1');
INSERT INTO course
VALUES (102, 'Desc 2');
INSERT INTO course
VALUES (103, 'Desc 3');
INSERT INTO student_course
VALUES (1, 101);
INSERT INTO student_course
VALUES (1, 102);
INSERT INTO student_course
VALUES (2, 101);
INSERT INTO student_course
VALUES (2, 103);
INSERT INTO student_course
VALUES (3, 101);
INSERT INTO student_course
VALUES (3, 102);
INSERT INTO student_course
VALUES (3, 103);
COMMIT ;
WITH st_crs_cnt AS
(SELECT student_id,
COUNT (*) tot
FROM student_course
GROUP BY student_id)
SELECT sc.student_id,
sc.tot
FROM st_crs_cnt sc
WHERE sc.tot = (SELECT COUNT (*) FROM course); -
Query for UDT over different Databases on another Server
Hi,
i want to use via query an UDT from another Database on another Server...
nomal Tables can be Used like this:
select* from [SVR-Name].Database.dbo.OITM
But if I try the same for an UDT:
select* from [SVR-Name].Database.dbo.[@UDT]
it doesn't work.
Does anyone have an Idea for me ?
Thx.
MarkusThx for your replies,
a query over different Databases on the same SQL-Server is no problem.
... but I want to select an UDT which is on another SAP-Server (other location) in a different Database.
Servername = SVR
Database = LIVE
UDT = [@portfolio]
select * from [SVR].LIVE.DBO.[@portfolio]
doesn't work.
(normal query to reach OITM for example:
select * from [SVR].LIVE.DBO.OITM
works fine !! -
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" -
Avoiding concurrency errors when updating a database through AJAX
What are some strategies for avoiding concurrency errors when updating a database through AJAX. That is, in cases where a given user could attempt to modify the same row in the database with simultaneous requests (say, that he updates one column with information with an AJAX call, then immediately submits a form that updates the same row), what are some good ways yo prevent the two updates from colliding? On the JavaScript side one might make the AJAX call synchronous, but I question whether that is the best way to do it. Has anyone else confronted this?
Well, since no one seems to have any ideas so far, I'll throw in my two cents worth.
I'm not too familiar with AJAX so my advice may be limited.
I suggest you do a google search on Optimistic concurrency database to get some ideas on how to handle it.
If your update/insert/delete query is thread safe, then even if the same user double clicks the button fast enough to immediately have another update to the same record, then the first update will complete before the second one is carried out. Therefore no harm is done since he is just updating the same record. Since a typical update/insert/delete takes only a few milliseconds (querying may take a lot more time), its not likely he can click the button that fast. (I assume your using connection pooling for speed).
The trouble comes up when two people call up data from the same record in different browsers. The first one updates/inserts/deletes the record. Now the other user is looking at old data. When he updates/inserts/deletes, there is a problem. One way to handle this is to keep a copy of all the fields from that record in each user's session scope when they first fetch it from the database (example: oldName). Then when you go to update some time later, to this:
sql= update person set name=newValue where personID=3344 and name=oldName
Note oldName is from session scope.
If name in the database has changed, the update will not occur and will return 0 records updated. If it didn't change, it will update.
Note your update function should not throw an exception if it cant update, it should return false. Return true if it worked.
Example: public boolean updateName(String name)
Similiarly, your insert should not throw an exception if the record already exists, it should return false meaning it cant insert.
Exaple: public bolean insertName(String name). Same thing with delete function.
If a record cant be updated due to someone else updating the record while the user was looking at data, return a message that it wasn't updated due to that problem. Then show the user the new value in the database ask him if he wants to overwrite the new change.
Note even if you show 100 records on the JSP, only update the ones that have changed and not all 100. This way, its not likely he has updated the same records someone else has altered. Less likely a colision compared to updating all 100.
If your updating/inserting/deleting more than 1 record (say, 3), then you should look into setting up a transaction in addition to all the above and rolling back all of them if one fails.
Reading the section on databases from http://www.javapractices.com/home/HomeAction.do may also help. -
Select query based on joining of tables from different database is taking too long
Hi Team,
Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million records and also Table3 and Table4 (of different database) might
contain close to 1million records.
Select T1.*
From DB1.dbo.Table1 T1
Join DB1.dbo.Table2 T2 on RTRIM(T1.Col3) = RTRIM(T2.Col3)
Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
Join Table3 U on CA.Col2 = U.Col2 AND RTRIM(T2.Col2) = U.Col3
Where U.Col4 NOT IN ('A1', 'A2', 'A3', 'A4', 'A5', 'A6','A7','A8','A9')
And (T1.flg IS NULL OR T1.flg = 'N')
And LTRIM(RTRIM(T2.Col2)) NOT IN ('B1','B2')
How can i improve the performance of this query. Actual thing is update the data in Db1.dbo.table1 based on the conditions but if the select is taking close to 1hr then update will take hours together. Indexes already implemented on all the tables.
Thanks,
Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.Thanks.
Join Table4 CA on RTRIM(T1.Col1) + T2.Col2 = CA.Col1
This join is not working with spaces if Rtrim is not used.
Thanks! Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.
Maybe you are looking for
-
How do I forward multiple emails together as one email?
I need to send several emails to someone. I can forward an email, but need to include several other emails within the body of the email, so that the recipient can see the whole thread. I have found how to put the additional emails in as attachments,
-
Can I play Itunes music via bluetooth on my Iphone 5 to my car radio?
Can I play Itunes music via bluetooth on my Iphne 5 to my car radio?
-
Sending mail with multiple attachments in jsp
hi .I wrote a code to send a mail in jsp.but now i need to send mails with multiple attachments.how can i send mail with multiple attachment.
-
Use older 2008 iMac as second monitor for new iMac
Hi all, I have one of these older machines that has no real purpose http://support.apple.com/kb/sp485 but would serve me very well as a second monitor for my brand spanking new iMac. The specs seem to note that there is a video output - but I'm not
-
Do I have to use WiFi to watch Amazon instant movies, or can I use 3G?
I'm staying in a hotel with very slow WiFi, and I'd like to watch movies from Amazon on my iPad 2. WIth WiFi, the movie buffers every few seconds, but when I try to watch using Verizon 3G, I get a message that I have to use WiFi. I'd appreciate any