I have an Issue running a psql script.
this is the output :
File.SQL:155: ERROR: syntax error at or near ":" LINE 10: date_temp_Ale INTEGER := :'param_date';
i have a file.sh that is calling the "File.sql" with and Input varible. here is the line that callsthe sql script:
echo le numero des parametres est bien 7
psql -v PGPASSWORD=$MDP -h $IP_MACHINE -f $FIC_REQ_SQL -v param_date=20180101 -U $UTILISATEUR -d $NOM_BDD -p $PORT > $FIC_LOG_EXEC_TMP 2>&1
echo Done in $FIC_LOG_EXEC_TMP
here is the line in the psql script: line in file.sql"
--- UT 48 PURGE DES TRACES
\set ON_ERROR_STOP on
BEGIN; -- DEBUT DE TRANSACTION
DO $$
DECLARE
num_tra_err_id RECORD;
num_trace_composant RECORD;
num_trace_fonctionnelle RECORD;
num_message_id RECORD;
num_metadonnees_id RECORD;
num_Process_id RECORD;
datediff integer;
date_temp_Ale INTEGER := :'param_date';
Max_days integer := 180;
--date_limite varchar := &1;
BEGIN
i also tried to use the command " --set " in the file.sh but it didn't work.