473,396 Members | 1,895 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,396 software developers and data experts.

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_DATE.GET_DL(2292,'servicecall')
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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_DATE.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 2956
rj*****@shaw.ca (Bob M) wrote in message news:<e1**************************@posting.google. 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_DATE.GET_DL(2292,'servicecall')
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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_DATE.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.google. 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_DATE.GET_DL(2292,'servicecall')
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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_DATE.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_DATE.GET_DL(2292,'servicecall')
FROM ITSM_SER_CUSTOM_FIELDS
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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_DATE.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_DATE.GET_DL(2292,'servicecall')
FROM ITSM_SER_CUSTOM_FIELDS
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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.google.c om>...
Bob -

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

SELECT SLA_PENDING_DATE.GET_DL(2292,'servicecall')
FROM ITSM_SER_CUSTOM_FIELDS
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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(2292,'servicecall'),
TO_DATE('3000/12/31', 'YYYY/MM/DD'))
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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(2292,'servicecall'),
TO_DATE('3000/12/31', 'YYYY/MM/DD'))
where SCF_SER_OID = (select SER_OID from ITSM_SERVICECALLS 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
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...
8
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: ...
0
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....
5
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...
9
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...
6
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...
43
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
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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...
0
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...
0
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...
0
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,...

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.