DECODE IN TO CHAR

Dúvidas, dicas e truques de SQL, Select, Update, Delete, cláusulas, operações com joins, Funções em SQLs, etc
  

Poston Tue, 04 Dec 2007 7:59 am

HELLO MY DEAR GOOD MORNING! The question TODAY is this: HAVE a FUNCTION that MY GOOD FRIEND of ARARUAMA HAD GIVEN ME in PREVIOUS TOPICS, was of GREAT HELP BUT NOW I'M WANTING to GIVE a ENCREMENTADA, type: SELECT (TO_CHAR (start_date, ' dd/mm/yyyy ') 2 || ' | '
3 || FLOOR (TRUNC (end_date)-TRUNC (start_date)) 4 || ' days | '
5 || TO_CHAR (end_date, ' dd/mm/yyyy ') 6) 7 days * FROM mens_erro2 OK THEN I WOULD LIKE the FOLLOWING when the RETURN of ROYALTY is NULL \"EMPTY\" I WOULD LIKE to USE the DECODE to FILTER WOULD LOOK LIKE THIS + or-DATAINICIO | DAYS BETWEEN DATES | DATAFIM IF THE DATE ORDER WAS NULL I WANTED TO SHOW A MESSAGE TYPE ACTIVE USER BUT IT SHOWS THE DAYS THAT THE USUARUO HAVE BETWEEN THE DATES.


A STRONG HUG TO ALL.
carlos12
Location: rio

Poston Tue, 04 Dec 2007 8:10 am

Brother, see if it's more or less this:
Code: Select all

SELECT (   TO_CHAR (SYSDATE, 'dd/mm/yyyy')
        || ' | '
        || DECODE ( FLOOR (TRUNC (SYSDATE + 10) - TRUNC (SYSDATE)), NULL, 'Usuário Ativo',  FLOOR (TRUNC (SYSDATE + 10) - TRUNC (SYSDATE)))
        || ' dias | '
        || (TO_CHAR (SYSDATE + 10, 'dd/mm/yyyy'))
       ) dias
  FROM DUAL
gives a tailored messages to your case and, qualquer thing sends ai.
Last edited by Trevisolli on Tue, 04 Dec 2007 8:10 am, edited 1 time in total.
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Poston Tue, 04 Dec 2007 8:10 am

I ONLY DO A DEXA ADDENDUM HERE My Friend Is Not ARARUAMA And YES: Christian (Tineks) Araraquara-SP Was BAD, I'M STILL JUST A LITTLE SLEEPY CRISTIANO ERRING, RS
carlos12
Location: rio

Poston Tue, 04 Dec 2007 8:32 am

I miss it when I saw araruama kkkkkkkkkk, but quiet my friend!!
It is normal for the staff change the name here. heheheheheheh [] 's!!!!
Tineks
Location: Araraquara - SP

Cristiano (Tineks)
Araraquara - SP

Poston Tue, 04 Dec 2007 8:45 am

GUY is GIVING a VERY CRAZY (TO_CHAR (dtinicio, ' dd/mm/yyyy '), DECODE (FLOOR (TRUNC (DTEXCLUSAO + 10)-TRUNC (SYSDATE)), NULL, ' Active ' User, FLOOR (TRUNC (SYSDATE + 10)-TRUNC (SYSDATE))) || ' days | '
|| (TO_CHAR (SYSDATE + 10, ' dd/mm/yyyy ')) days, HE'S GIVING 10 DAYS for DIFFERENCE BETWEEN the TYPE DATE: the date that is NULL is CORRECT BUT the difference BETWEEN the OTHER'S WRONG HE'S BRINGING 10 DAYS for ALL
carlos12
Location: rio

Poston Tue, 04 Dec 2007 8:52 am

It is because of this SYSDATE + 10 brother, I put an example.
You may be changing these SYSDATE as your need.

If applicable, send the definition of your tables for us to assemble based on your information, beleza?

qualquer thing, says ai.
Last edited by Trevisolli on Tue, 04 Dec 2007 8:57 am, edited 1 time in total.
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP

Poston Tue, 04 Dec 2007 8:55 am

Trevisolli FACE the ERROR was MINE, aqui and COVENANTED rs SHOW DE BOLA, FOUGHT MY BUDDY!
carlos12
Location: rio

Poston Tue, 04 Dec 2007 8:57 am

Blzera brother.
qualquer thing, we're there.
Trevisolli
Location: Araraquara - SP

Abraço,

Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP



Return to SQL

Who is online

Users browsing this forum: No registered users and 3 guests