concatenation dans une variable de procédure stockée
Bonjour à tous,
Encore moi désolé c'est des questions un peu bête mais je n'y trouve aucune réponse :cry:
Je cherche à traduire ce passage dans une procédure écrite en T-SQL
Code:
1 2 3 4
| create procedure proc_paie_doublepaie_1003 @cigap char(2)
as
declare @date numeric(8)
select @date = convert(numeric(8), ('20' + '1003'+ '01')) |
Mis à part que j'ai une partie de ma date qui arrivera d'un paramètre passé dans ma procédure (moisDePaie).
J'ai testé pas mal de chose, des concat, des to_char
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
create or replace procedure proc_paie_doublepaie
(
cigap in number,
moisDePaie in number)
AS
BEGIN
declare date1 number
SELECT date1 = to_char(moisDePaie)|| to_char('01');
FOR rec IN
(
select IDENT_NOM,
IDENT_IDENT,
AGENT_PAIE_NUMSS,
REFELT_CODE,
REFUP_CODE,
PAIE_MONTANT,
REFGRADE_CODE,
REFCSO_CODE,
AGENT_PAIE_ENTITE,
REFBUR_LIBELLE,
REFFONCTION_CODE
from DOUBLON_PAIE
where AGENT_PAIE_CIGAP like cigap
AND AGENT_PAIE_AAAAMM = moisDePaie
and AGENT_DATE = date
order by IDENT_NOM
)
loop
dbms_output.put_line(rec.IDENT_NOM||' '|| rec.IDENT_IDENT||' '|| rec.AGENT_PAIE_NUMSS||' '|| rec.REFELT_CODE||' '|| rec.REFUP_CODE||' '|| rec.PAIE_MONTANT||' '|| rec.REFGRADE_CODE||' '|| rec.REFCSO_CODE||' '|| rec.AGENT_PAIE_ENTITE||' '|| rec.REFBUR_LIBELLE||' '|| rec.REFFONCTION_CODE);
end loop;
END proc_paie_doublepaie; |
ou encore
Code:
SELECT date1 = concat((moisDePaie,'01'))
ou encore
Code:
set date1 = to_char(moisDePaie) || to_char('01')
rien à faire j'ai les mêmes erreurs qui ressortent
Code:
1 2 3 4 5 6
|
Error(10,1): PLS-00103: Encountered the symbol "SELECT" when expecting one of the following: := . ( @ % ; not null range default character The symbol ":= was inserted before "SELECT" to continue.
Error(13,2): PLS-00103: Encountered the symbol "FOR" when expecting one of the following: begin function pragma procedure subtype type <an identifier> <a double-quoted delimited-identifier> current cursor delete exists prior The symbol "begin" was substituted for "FOR" to continue.
Error(35,25): PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge |
Je suis déprimé j'ai besoin de vous :aie:
Merci,
NarbO