Re: PL/PGSQL
От | Martin Gainty |
---|---|
Тема | Re: PL/PGSQL |
Дата | |
Msg-id | BLU142-W24EFACAD9FD25D6C5217BCAE470@phx.gbl обсуждение исходный текст |
Ответ на | PL/PGSQL (Jordi Martínez <jmartinez@uic.es>) |
Список | pgsql-general |
mg>hopefully quick response
Hello everybody,
I'm Jordi from Spain, I'm new on this mailing list. I hope I could help anybody in the future but now I new some help because I read a lot of documentation but I can't find an answer.
I have two questions:
--------------------------------------------------------------------------------------------------
1.- Exception throwed by cast('yyyymmdd' as timestamp)
I do a cast conversion from a string to a timestamp. When I put a bad date on the string, the cast throw an error on my PL/PGSQL but I can't capture (I'm new). Which type of exception launch the cast function?
I put a exception space on my function but I don't know which exception I have ti capture:
EXCEPTION
WHEN exception_name THEN
MG>when VALUE_ERROR THEN
MG>DBMS_OUTPUT.PUT_LINE('Cannot convert STRING to DATE');
statements;
Which exception _name I have to write on my code?
--------------------------------------------------------------------------------------------------
2.- Number of days on February
I'm parsing a string with a date with format 'yyyymmdd' for testing if it's a valid date.
I need to know if the day is correct for the month on the string, but February is different for every year. How can I know if February have 28 or 29 days depending on the year?
MG>select TO_CHAR(DATE_COLUMN,'DD') FROM TABLE;
Thanks everybody and hello from a new user ;-)
Windows Live™: Keep your life in sync. Check it out.
Hello everybody,
I'm Jordi from Spain, I'm new on this mailing list. I hope I could help anybody in the future but now I new some help because I read a lot of documentation but I can't find an answer.
I have two questions:
--------------------------------------------------------------------------------------------------
1.- Exception throwed by cast('yyyymmdd' as timestamp)
I do a cast conversion from a string to a timestamp. When I put a bad date on the string, the cast throw an error on my PL/PGSQL but I can't capture (I'm new). Which type of exception launch the cast function?
I put a exception space on my function but I don't know which exception I have ti capture:
EXCEPTION
WHEN exception_name THEN
MG>when VALUE_ERROR THEN
MG>DBMS_OUTPUT.PUT_LINE('Cannot convert STRING to DATE');
statements;
Which exception _name I have to write on my code?
--------------------------------------------------------------------------------------------------
2.- Number of days on February
I'm parsing a string with a date with format 'yyyymmdd' for testing if it's a valid date.
I need to know if the day is correct for the month on the string, but February is different for every year. How can I know if February have 28 or 29 days depending on the year?
MG>select TO_CHAR(DATE_COLUMN,'DD') FROM TABLE;
Thanks everybody and hello from a new user ;-)
Windows Live™: Keep your life in sync. Check it out.
В списке pgsql-general по дате отправления: