Good morning people.
I have a question that I think is BRaba I need to make a select that brings the Sundays and holidays of the year 2007.
In the Sundays and holidays of 2007 in Oracle I have the field date that has the normal dates
personal I need a lot of this help.
Hesitate to select with holidays and weekends
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother,
Good morning.
To get Saturdays and Sundays, quiet:
Hence, make sure it is Saturday or Sunday in this return.
As for the holidays, then you have to have a registration on your system, okay?
Whatever, send it there.
Good morning.
To get Saturdays and Sundays, quiet:
SELECT TO_CHAR(SYSDATE,'DY') FROM DUAL;
Hence, make sure it is Saturday or Sunday in this return.
As for the holidays, then you have to have a registration on your system, okay?
Whatever, send it there.
Trevisolli
Let's go by parts. First Sunday
As I can in a select differentiate type only bring the Sundays type
I tried this but not Can not you ??
Let's go by parts. First Sunday
As I can in a select differentiate type only bring the Sundays type
SELECT TO_CHAR(u.dtinicio,'DY') FROM usuario u
where u.dtinicio like 'DOM';
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother, come on!
To get Saturday or Sunday (watch for the bank configuration, in case, here in English, therefore, Saturday = Sat (Saturday) and Sunday = Sun (Sunday), beleza? ).
to do the tests there, change the date of 04/13/2008, which is a Sunday, by the date the user provide you, beleza?
As for the holidays, you must have a registration in your system, so only apply the rule above, when Saturday, Sunday or a holiday from your table, beleza?
Whatever, send it there.
To get Saturday or Sunday (watch for the bank configuration, in case, here in English, therefore, Saturday = Sat (Saturday) and Sunday = Sun (Sunday), beleza? ).
DECLARE
vdia VARCHAR2(03);
BEGIN
SELECT TO_CHAR (TO_DATE ('13/04/2008', 'dd/mm/rrrr'), 'DY')
INTO vdia
FROM DUAL;
IF vdia IN ('SAT','SUN')
THEN
raise_application_error(-20001, 'Data não permitida: '||vdia||' pois não é um dia útil.');
ELSE
dbms_output.put_line('Dia válido. '||vdia);
END IF;
END;
As for the holidays, you must have a registration in your system, so only apply the rule above, when Saturday, Sunday or a holiday from your table, beleza?
Whatever, send it there.
Legal boy but looks only I need this for a select not to insert anything in bd type the user would enter with a rang of dates type
there Select only brings dates related to Sunday, my dates are in Portuguese type when I did:
He returned
SAB
DOM
chi
and so on
u.dtinicio between '&data_INI' and '&data_fim'
SELECT TO_CHAR(u.dtinicio,'DY') FROM usuario u
SAB
DOM
chi
and so on
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother,
From what I understand, the user will enter a range of dates and, you want to show him only business days, is that it?
From what I understand, the user will enter a range of dates and, you want to show him only business days, is that it?
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Ai brother, do a tests:
in pl / sql :
or, with sql It is also possible:
whatever, send it there.
in pl / sql :
--Ex.01/01/2007 à 30/04/2007
DECLARE
vdata_ini DATE := TO_DATE('01/01/2007','dd/mm/rrrr');
vdata_fim DATE := TO_DATE('30/04/2007','dd/mm/rrrr');
vdias PLS_INTEGER := 0;
BEGIN
vdias := (vdata_fim - vdata_ini);
FOR x IN 1..vdias
LOOP
IF TO_CHAR(vdata_ini, 'DY') = 'SUN' -- No teu caso, 'DOM'
THEN
-- Faça algo aqui.
dbms_output.put_line('Imprime a data na tela (Domingo): ' || TO_CHAR(vdata_ini, 'dd/mm/rrrr'));
END IF;
vdata_ini := vdata_ini + 1;
END LOOP;
END;
SELECT *
FROM sua_tabela
WHERE to_char(dta_atualizacao,'DY') = 'SUN' -- No teu caso, DOM
AND dta_atualizacao BETWEEN TO_DATE('01/01/2007','dd/mm/rrrr')
AND TO_DATE('30/04/2007','dd/mm/rrrr');
Trevisolli
face I apologize but I'm kind of slow let's go on the part where I put my table on this train? rs
Table = User
Field = Dtinicio
And in that part you put
99] - Do something here.
What is it to do?
face gets pissed no but is that I need it ...
strong hug
face I apologize but I'm kind of slow let's go on the part where I put my table on this train? rs
Table = User
Field = Dtinicio
And in that part you put
99] - Do something here.
What is it to do?
face gets pissed no but is that I need it ...
strong hug
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Brother,
Do with SQL I added in the previous code.
has the two forms, but, that of SQL meets your need, what would be to give a select on a table, returning only Sundays, beleza?
Whatever, send it, without crisis.
Do with SQL I added in the previous code.
has the two forms, but, that of SQL meets your need, what would be to give a select on a table, returning only Sundays, beleza?
SELECT *
FROM sua_tabela
WHERE to_char(dta_atualizacao,'DY') = 'SUN' -- No teu caso, DOM
AND dta_atualizacao BETWEEN TO_DATE('01/01/2007','dd/mm/rrrr')
AND TO_DATE('30/04/2007','dd/mm/rrrr');
-
- Moderador
- Posts: 2016
- Joined: Wed, 12 Jan 2005 3:25 pm
- Location: Araraquara - SP
Abraço,
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
Trevisolli
OCA Oracle PL/SQL Developer Certified Associate
OCP Oracle Forms Developer Certified Professional
Araraquara-SP
beleza BROTHER, good!
Needing, count on us.
Needing, count on us.
- Toad
- Rank: DBA Pleno
- Posts: 253
- Joined: Fri, 18 Nov 2005 2:14 pm
- Location: Seattle, WA
- Contact:
Matheus Gonçalves
matheus.dev
twitter.com/developer__c
matheus.dev
twitter.com/developer__c
http://en.glufke.net/oracle/search.php
I believe that this topic can also help:
http://en.glufke.net/oracle/viewtopic.p ... as+%FAteis
I believe that this topic can also help:
http://en.glufke.net/oracle/viewtopic.p ... as+%FAteis
-
- Information
-
Who is online
Users browsing this forum: No registered users and 3 guests