how to solve the following issue?
I need to copy from some tables to another tables, with the same fields , except for some additiona target fields that are variables coming from a form.
how can I perform this copy in the best, fastest and most robust way?
1. with a PL/SQL stored procedure ?
2. PL/SQL directly in the form ?
3. other... ?
and the main problem is:
the following is the right code? I always receive some error in APEX:
note: :P13_DATA, :P13_OPERATORE and :P13_ID_TEMPLATE are variables coming from the apex form
The others are fields I need to copy from a table to another one and I need an "insert to / select" because I need to copy from the source table to the target table different records.
what I'm going to try...
DECLARE
P_ID_TEMPLATE NUMBER;
P_ID_TURNO NUMBER;
P_VALIDO_DAL DATE;
P_NOME_IP VARCHAR2(100);
P_NOME_COORDINATORE VARCHAR2(100);
P_ID_CSRE NUMBER;
P_ID_REPARTO NUMBER;
P_ID_PIANO NUMBER;
P_NOTE VARCHAR2(100);
BEGIN
SELECT
M.ID_TEMPLATE,
M.ID_TURNO,
M.VALIDO_DAL,
M.NOME_IP,
M.NOME_COORDINATORE,
M.ID_CSRE,
M.ID_REPARTO,
M.ID_PIANO,
M.NOTE
INTO
P_ID_TEMPLATE,
P_ID_TURNO,
P_VALIDO_DAL,
P_NOME_IP,
P_NOME_COORDINATORE,
P_ID_CSRE,
P_ID_REPARTO,
P_ID_PIANO,
P_NOTE
FROM T_MANSIONARI_M M
WHERE M.ID_TEMPLATE = :P13_ID_TEMPLATE;
INSERT INTO T_MANSIONARI VALUES (
:P13_DATA,
P_ID_TEMPLATE,
P_TURNO,
:P13_OPERATORE,
P_VALIDO_DAL,
P_NOME_IP,
P_NOME_COORDINATORE,
P_ID_CSRE,
P_ID_REPARTO,
P_ID_PIANO,
P_NOTE
);
END;
Thanks a lot for your help
Luigi