Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RONALDO RODRIGUES DE OLIVEIRA
/
simec-scripts-banco
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fb526f8d
authored
Jan 30, 2025
by
RONALDO RODRIGUES DE OLIVEIRA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update PLpgSQLFunction-etiqNaturezaInteresse-REQ000000329189.sql
parent
f78a8040
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
PLpgSQLFunction-etiqNaturezaInteresse-REQ000000329189.sql
PLpgSQLFunction-etiqNaturezaInteresse-REQ000000329189.sql
View file @
fb526f8d
CREATE
OR
REPLACE
FUNCTION
par
.
naturezainteresse
(
CREATE
OR
REPLACE
FUNCTION
par
.
naturezainteresse_v2
(
iniciomandato
date
,
iniciomandato
date
,
fimmandato
date
,
fimmandato
date
,
iniciovigencia
date
,
iniciovigencia
date
,
fimvigencia
date
,
fimvigencia
date
,
programa
varchar
(
10
)
default
'
par
'
programa
varchar
(
10
)
default
'
AUSENTE
'
)
)
RETURNS
text
RETURNS
text
AS
$$
AS
$$
...
@@ -15,10 +16,17 @@ DECLARE
...
@@ -15,10 +16,17 @@ DECLARE
data_corte
date
;
data_corte
date
;
BEGIN
BEGIN
IF
programa
=
'AUSENTE'
THEN
RETURN
'ERRO - Falta paramentro-programa'
;
EXIT
;
END
IF
;
-- raise notice 'iniciomandato %, fimmandato %, iniciovigencia %, fimvigencia %, programa %', iniciomandato, fimmandato, iniciovigencia, fimvigencia, programa;
SELECT
SELECT
case
programa
case
UPPER
(
programa
)
when
'
pac
'
then
(
dpcdatainiciocontagem2
+
interval
'60 day'
)::
date
when
'
PAC
'
then
(
dpcdatainiciocontagem2
+
interval
'60 day'
)::
date
when
'
par
3'
then
(
dpcdatainiciocontagem3
+
interval
'60 day'
)::
date
when
'
PAR
3'
then
(
dpcdatainiciocontagem3
+
interval
'60 day'
)::
date
else
else
(
dpcdatainiciocontagem1
+
interval
'60 day'
)::
date
(
dpcdatainiciocontagem1
+
interval
'60 day'
)::
date
end
into
data_corte
end
into
data_corte
...
@@ -29,7 +37,7 @@ BEGIN
...
@@ -29,7 +37,7 @@ BEGIN
ELSE
ELSE
data_final_pc
:
=
fimvigencia
+
60
;
data_final_pc
:
=
fimvigencia
+
60
;
END
IF
;
END
IF
;
raise
notice
'data_final_pc %'
,
data_final_pc
;
--
raise notice 'data_final_pc %', data_final_pc;
IF
fimmandato
IS
NULL
THEN
IF
fimmandato
IS
NULL
THEN
natureza
:
=
'Atual Gestor /'
;
natureza
:
=
'Atual Gestor /'
;
IF
((
iniciomandato
>=
iniciovigencia
)
AND
(
iniciomandato
<=
fimvigencia
))
THEN
IF
((
iniciomandato
>=
iniciovigencia
)
AND
(
iniciomandato
<=
fimvigencia
))
THEN
...
@@ -81,10 +89,23 @@ $$ language PLPGSQL;
...
@@ -81,10 +89,23 @@ $$ language PLPGSQL;
* Excluir objeto
* Excluir objeto
*/
*/
/*
/*
drop FUNCTION par.naturezainteresse(
drop FUNCTION par.naturezainteresse
_v2
(
iniciomandato date,
iniciomandato date,
fimmandato date,
fimmandato date,
iniciovigencia date,
iniciovigencia date,
fimvigencia date,
fimvigencia date,
programa varchar(10)
programa varchar(10)
)
)
*/
/* Testes para chamada direta.
select * from par.naturezainteresse_v2('2017-01-01', '2023-11-07', '2018-05-15', '2019-05-15','par3');
select * from par.naturezainteresse_v2('2017-01-01', '2023-11-07', '2018-05-15', '2019-05-15');
select * from par.naturezainteresse_v2('2023-11-08',null, '2018-05-15', '2019-05-15','par3');
select * from par.naturezainteresse_v2('2023-11-08',null, '2018-05-15', '2019-05-15');
*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment