Jump to content

dev botao

Stored Procedure com CTE Firebird 2.5


Rodrigo Cardilo
  • Este tópico foi criado há 1541 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

  • Moderadores

Não sei se entendi bem a dúvida ou o propósito, mas testei dessa forma e rodou:

CREATE OR ALTER PROCEDURE SP_DATES 
returns (
    D date)
as
begin
FOR WITH RECURSIVE
DATES (DT) AS (
SELECT CURRENT_DATE
FROM RDB$DATABASE
UNION ALL
SELECT DT + 1 FROM DATES
WHERE DT < CURRENT_DATE + 31
)
SELECT DT FROM DATES INTO :D do
 suspend;
end

E:

CREATE VIEW VW_DATES(
    D)
AS
WITH RECURSIVE
DATES (DT) AS (
SELECT CURRENT_DATE
FROM RDB$DATABASE
UNION ALL
SELECT DT + 1 FROM DATES
WHERE DT < CURRENT_DATE + 31
)
SELECT DT FROM DATES
;

 

Equipe ACBr BigWings
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

 

 

Link to comment
Share on other sites

  • Este tópico foi criado há 1541 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.