Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Google search


Poll
How big is your Baan-DB (just Data AND Indexes)
0 - 200 GB
14%
200 - 500 GB
32%
500 - 800 GB
4%
800 - 1200 GB
4%
1200 - 1500 GB
11%
1500 - 2000 GB
14%
> 2000 GB
21%
Total votes: 28

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 13th April 2018, 14:20
Santosh_mali Santosh_mali is offline
Junior Member
 
Join Date: Jun 2016
Posts: 12
Santosh_mali is on a distinguished road
Baan: Baan 4 - DB: oracle - OS: unix
Post Error 509 while db.update()
Baan: Baan IVc2
C/S: None/Unknown

Hi All,

I am doing update operation using dynamic SQL.
Parsing and all is happening correct but db.update is returning value 509.

Please help if anybody knows how to resolve this issue.
Here is the code,
Code:
function dynamic.table.update( domain tcmcs.str8 inp.table,
				domain tcmcs.long inp.index,
				domain tcmcs.str8 inp.key1,
				domain tcmcs.str4 inp.field,
				domain tcmcs.str4 new.value)
{
	string 	sql.string(512), str1(100)
	long 	sql, var1, ret
	
	db.retry.point()
	
	sql.string = "select " 	& strip$(inp.table) & "." & strip$(inp.field) & " " & 
		     "from "  	& strip$(inp.table) & " for update " 	&
		     "where " 	& strip$(inp.table) & "._index" & str$(inp.index) & " = { :1 }" 

	if (not sql) then
		sql = sql.parse(sql.string)
	endif
	
	sql.where.bind(sql, 1, inp.key1)	
	sql.exec(sql)
	
	while(true)
		on case(sql.fetch(sql))
		case eendfile:
			break
		case enorec:
			break
		case 0:
			str1 = strip$(inp.table) & "." & strip$(inp.field) & ":=" & str$(new.value) 
			var1 = expr.compile(str1) 
			s.expr$(var1) 
			
			ret = db.update(sql, db.retry) |# on this line ret = 509
			if ret = 0 then
				commit.transaction()
			endif
		endcase
		break
	endwhile

	sql.break(sql)
	sql.close(sql)
	
	sql = 0	
}
Reply With Quote
  #2  
Old 13th April 2018, 15:23
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,135
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
Is there in thing in any of the log files that might give more information. I was kind of expecting the db.update to have inp.table, but never used dynamic sql for updates that I recall.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
  #3  
Old 13th April 2018, 15:49
Santosh_mali Santosh_mali is offline
Junior Member
 
Join Date: Jun 2016
Posts: 12
Santosh_mali is on a distinguished road
Baan: Baan 4 - DB: oracle - OS: unix
Hi Mark,

Log file not showing any information.
inp.table is string so directly cannot be used in db.update.
instead used variable sql which used to bind the table.
Reply With Quote
  #4  
Old 14th April 2018, 01:16
mark_h's Avatar
mark_h mark_h is offline
Guru
 
Join Date: Sep 2001
Location: Kentucky, USA
Posts: 7,135
mark_h will become famous soon enough
Baan: Baan 4C4 A&D1 - DB: Oracle - OS: Sun Solaris
See if this thread helps - http://www.baanboard.com/baanboard/s...mic+sql+update. Looks like the bind might be a little different for the table.
__________________
Mark

GO Cards!
My latest mantra - make sure you have latest stpapi patches and the latest session object. If on LN then please explore the option of using DAL2 functionality.

Shared Solutions for Baan systems provided free by Baan Board.
Play the Google game and help Baanboard get better rankings. Do your part. Click here to find how.
Reply With Quote
Sponsored Links
  #5  
Old 17th April 2018, 11:47
giggty's Avatar
giggty giggty is offline
Senior Member
 
Join Date: May 2017
Posts: 104
giggty is on a distinguished road
Baan: Infor ERP 10.6 - DB: MSSQL Server 2008 R2 - OS: Windows Server 2012
Code:
ret = db.update(sql, db.retry)
db.update requires pointer to table as its first argument, use db.bind()
Reply With Quote
  #6  
Old 6th August 2018, 14:16
Sahil Sharma Sahil Sharma is offline
Junior Member
 
Join Date: Jul 2018
Posts: 15
Sahil Sharma is on a distinguished road
Baan: FP 10.4 - DB: BAAN - OS: windows 10
This error indicates that you have a bad memory cursor or that a bad table pointer has been specified.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
db.update and db.insert not works... suhas-mahajan Tools Development 5 14th May 2007 16:58
db.update on an array ltannous Tools Development 7 12th May 2005 00:00
db.update problem ltannous Tools Development 2 27th February 2004 23:57
db.update for tiitm001 (cross companies) ltannous Tools Development 2 15th October 2002 04:30
db.update - does not recognize hardcoede supplier in script ltannous Tools Development 2 14th October 2002 11:07


All times are GMT +2. The time now is 17:35.


©2001-2018 - Baanboard.com - Baanforums.com