473,804 Members | 3,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem trying to update a record with a value returned by a function

Hi all,

I am trying to update a record with a function value. Here is the
function:

update ITSM_SER_CUSTOM _FIELDS
set SCF_SCDATE2 = SLA_PENDING_DAT E.GET_DL(2292,' servicecall')
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where
SER_ID = 2292);

When I run this statement, I get the message "1 row updated". After
doing a commit, I look at the record in question and the SCF_SCDATE2
field is blank.

When I run the statement:

select SLA_PENDING_DAT E.GET_DL(2292,' servicecall') from dual;

I get a valid date returned.

If I modify my SQL statement to substitute "sysdate" for the function
value, the current date appears in the field.

Any ideas why is the date field not being updated in the db when I use
the function?

Thanks for any help,
Bob
Jul 19 '05 #1
6 2986
rj*****@shaw.ca (Bob M) wrote in message news:<e1******* *************** ****@posting.go ogle.com>...
Hi all,

I am trying to update a record with a function value. Here is the
function:

update ITSM_SER_CUSTOM _FIELDS
set SCF_SCDATE2 = SLA_PENDING_DAT E.GET_DL(2292,' servicecall')
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where
SER_ID = 2292);

When I run this statement, I get the message "1 row updated". After
doing a commit, I look at the record in question and the SCF_SCDATE2
field is blank.

When I run the statement:

select SLA_PENDING_DAT E.GET_DL(2292,' servicecall') from dual;

I get a valid date returned.

If I modify my SQL statement to substitute "sysdate" for the function
value, the current date appears in the field.

Any ideas why is the date field not being updated in the db when I use
the function?

Thanks for any help,
Bob


Bob, verify that the table column type and the function return type
are the same or add the necessary explicit conversion.

You show that the function returns the expected value, but does the
subquery return the expected value.

Also by blank, do you mean NULL?

HTH -- Mark D Powell --
Jul 19 '05 #2
rj*****@shaw.ca (Bob M) wrote in message news:<e1******* *************** ****@posting.go ogle.com>...
Hi all,

I am trying to update a record with a function value. Here is the
function:

update ITSM_SER_CUSTOM _FIELDS
set SCF_SCDATE2 = SLA_PENDING_DAT E.GET_DL(2292,' servicecall')
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where
SER_ID = 2292);

When I run this statement, I get the message "1 row updated". After
doing a commit, I look at the record in question and the SCF_SCDATE2
field is blank.

When I run the statement:

select SLA_PENDING_DAT E.GET_DL(2292,' servicecall') from dual;

I get a valid date returned.

If I modify my SQL statement to substitute "sysdate" for the function
value, the current date appears in the field.

Any ideas why is the date field not being updated in the db when I use
the function?

Thanks for any help,
Bob

Bob -

For giggles, try this and see what you get as a result...

SELECT SLA_PENDING_DAT E.GET_DL(2292,' servicecall')
FROM ITSM_SER_CUSTOM _FIELDS
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where SER_ID = 2292);

Dave
Jul 19 '05 #3
>
Bob, verify that the table column type and the function return type
are the same or add the necessary explicit conversion.

You show that the function returns the expected value, but does the
subquery return the expected value.

Also by blank, do you mean NULL?

HTH -- Mark D Powell --


Mark,

Thanks for the reply.

The column datatype and the function return both have a DATE datatype.

The subquery returns a OBJid. I have tried substituting the OBJid
value for the subquery
update ITSM_SER_CUSTOM _FIELDS
set SCF_SCDATE2 = SLA_PENDING_DAT E.GET_DL(2292,' servicecall')
where SCF_SER_OID = 281479223967745 ;

but same result.
And finally the SCF_SCDATE2 field is null not blank (sorry for the
slip there).

I thought I read somewhere on the Net about a restriction on calling a
PL/SQL function or procedure within an insert or update statement.
Any idea if this is true?

Cheers,
Bob
Jul 19 '05 #4
> Bob -

For giggles, try this and see what you get as a result...

SELECT SLA_PENDING_DAT E.GET_DL(2292,' servicecall')
FROM ITSM_SER_CUSTOM _FIELDS
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where SER_ID = 2292);

Dave


Dave,

This select statement returns a date.
The same if I perform a select function(p1,p2) from dual.

Bob
Jul 19 '05 #5
rj*****@shaw.ca (Bob M) wrote in message news:<e1******* *************** ***@posting.goo gle.com>...
Bob -

For giggles, try this and see what you get as a result...

SELECT SLA_PENDING_DAT E.GET_DL(2292,' servicecall')
FROM ITSM_SER_CUSTOM _FIELDS
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where SER_ID = 2292);

Dave


Dave,

This select statement returns a date.
The same if I perform a select function(p1,p2) from dual.

Bob


Bob -

I'm stumped. Another thought at isolating the problem....use the NVL
function as shown below. If the column is updated with the hard-coded
date, this would further prove your function IS returning NULL in this
context.

update ITSM_SER_CUSTOM _FIELDS
set SCF_SCDATE2 = NVL(SLA_PENDING _DATE.GET_DL(22 92,'servicecall '),
TO_DATE('3000/12/31', 'YYYY/MM/DD'))
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where
SER_ID = 2292);

Dave
Jul 19 '05 #6
> Bob -

I'm stumped. Another thought at isolating the problem....use the NVL
function as shown below. If the column is updated with the hard-coded
date, this would further prove your function IS returning NULL in this
context.

update ITSM_SER_CUSTOM _FIELDS
set SCF_SCDATE2 = NVL(SLA_PENDING _DATE.GET_DL(22 92,'servicecall '),
TO_DATE('3000/12/31', 'YYYY/MM/DD'))
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECAL LS where
SER_ID = 2292);

Dave


Thanks for the suggetion Dave. I tried the NVL function and I am
indeed inserting a null value in the table. Or at least I was (now I
have an entry of 3000/12/31) ;-)

I'm baffled as to why the fuction returns a null inside a SQL
statement but returns a valid date when I run it as a separate SQL
statement.

Oh well. C'est la vie!

Guess I'll play around with calling the function from a trigger which
was going to be my next development step anyway.

Thanks again for the suggestion.

Bob
Jul 19 '05 #7

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

Similar topics

3
2081
by: redneck_kiwi | last post by:
Hi all: I have a really weird problem. I am developing a customer catalog system for my company and as such have delved into sessions for authentication and access levels. So far, I have managed to get a working system just about finished. I am building an interface for our customer service folks to use to manage registered customers and am seeing some weird behavior.
8
7106
by: mark | last post by:
Access2000 How do I write a query that combines the CTC field from each record below into one record? I need to concatenate the CTC field with a separator, like below: BattID VehicleID STDATE STTIME CTC LKO500HF 00000000 10/27/2003 4:13:51 AM 4 LKO500HF 00000000 10/27/2003 5:13:51 AM 5 LKO500HF 00000000 10/27/2003 10:13:51 AM 6 LKO500HF 00000000 10/27/2003 11:13:51 AM 4
0
3945
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
5
2042
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated one row, all of them were updated so i immediatelly figured out that i have to include the id of every entry in the update statement. This is where the problem is raised. My database is an Access database. The table i am updating contains a Date...
9
3288
by: thomasp | last post by:
First of all, thanks for the help on my previous VB.NET/MS Access questions. This time I need do the following 1. Connect to a table 2. step through each of its records 3. read the value of two of the records fields 4. pass those values to a function 5. write the value returned by the function the same record in a third field Hope this makes sense. Basically I want to read records and based on values
6
148
by: Bob M | last post by:
Hi all, I am trying to update a record with a function value. Here is the function: update ITSM_SER_CUSTOM_FIELDS set SCF_SCDATE2 = SLA_PENDING_DATE.GET_DL(2292,'servicecall') where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS where SER_ID = 2292);
43
2395
by: John | last post by:
Hi This .net is driving me crazy!! In VB6 I had a type which contained a couple of multi-dimentional arrays which i used to create and read records: Type AAA : Array1(10,10,2) as Integer
2
2641
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database. In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
0
9706
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
10569
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...
0
10325
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
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
10075
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
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...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.