Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread View values as function processes??
Thu, Feb 1 2024 12:50 AMPermanent Link

Ian Branch

Avatar

Hi Team,
I have this function:
{sql}
create FUNCTION ConvertDurationToSeconds(in durationString CHAR(12))
RETURNS BIGInt
BEGIN
   DECLARE hours INT;
  Declare minutes INT;
  Declare seconds DECIMAL(6,4);
  set hours = Cast(Substring(durationString from 1 for 3) as Int);
   SET minutes = cast(Substring(durationString from 5 for 2) as Int);
   SET seconds = CAST(Substring(Durationstring from 8 for 2)+ '.'+ Substring(durationstring from 11 for 2) AS DECIMAL(6,4));
   RETURN hours * 3600 + minutes * 60 + seconds;
END;
{sql}
I would like to be able to the values of hours, minutes & seconds as the function processes them.
Suggestions would be appreciated.

Regards & TIA,
Ian
Thu, Feb 1 2024 7:58 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


What would you like "to be able to the values" and what's stopping you?

Roy Lambert
Thu, Feb 1 2024 12:51 PMPermanent Link

Ian Branch

Avatar

Serves me right for not being careful enough after 8 hours at the keyboard... Frown
I want to see in some form each of the hours, minutes,seconds values as the function processes.
It can be written to a log or simply seen on-screen.

Ian
Fri, Feb 2 2024 3:09 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Ian


Some bright spark might be able to come up with something but my advice is to give up. SQL is not meant as a display language and anything you do is liable to severely mess up the machine its running on. That's my thought since you'd be interfering with the SQL process which is intended to act in an atomic fashion.

Of course that's based on the (possibly erroneous) assumption that I understand what you want to achieve.

Roy Lambert
Fri, Feb 2 2024 2:38 PMPermanent Link

Terry Swiers


> I want to see in some form each of the hours, minutes,seconds values as the function processes. It can be written to a log or simply seen on-screen.

I assume you are trying to debug the function.  Rework the function as a script with parameters and you can debug that within EDB Manager to see what the values are as it is processing.  
Fri, Feb 2 2024 3:50 PMPermanent Link

Ian Branch

Avatar

Hi All,
Thank you for your inputs.
I have eliminated the need for the function now.  Wink

Regards,
Ian
Sat, Feb 3 2024 2:57 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Terry


Good catch - I never thought of the need for debugging.

Roy Lambert
Image