What is the syntax to add a field to a column?

0

I need to know the syntax to add a field to a column, that is, I have to create an anonymous block where I ask the user to write me a name, after that I have to create a procedure to add the name that has given me past.

Here I ask the user to write me a name:

set serveroutput on
set verify off
set echo off
accept constituent prompt 'Introduce el nombre del constituente: '
begin
  alta_constituent(&constituent);
end;

And here I have to add a new row to the table with the name that has happened to me before:

create or replace procedure alta_constituent(constituent)
is
begin
insert into constituent
(nom_constituent) values (&constituent)
end alta_constituent;

I know the code is incomplete but I just need the structure, thank you very much.

    
asked by Marc 07.04.2018 в 20:13
source

1 answer

0

to be able to do what you want you have to do it with execution of dynamic sentences, with EXECUTE IMMEDIATE. It would be something like this:

V_CONSULTA :='INSERT INTO ....';
EXECUTE IMMEDIATE V_CONSULTA;
    
answered by 17.04.2018 в 17:32