Skip to main content
edited tags
Link
Justin Cave
  • 232.6k
  • 25
  • 378
  • 395
Formatted code
Source Link
Justin Cave
  • 232.6k
  • 25
  • 378
  • 395

I am new to PL SQL Code and need help writing Insert query statement . eg: I want to insert Employee in Employees table where only employee name changes but the city is constant. DECLARE emp_var_prefix varchar2(12) := 'QATEST'; emp_var_temp varchar2(12) := ''; city constant varchar(30) := 'dallas'

begin DBMS_OUTPUT.ENABLE; for i in 1..2 loop emp_var_temp := emp_var_prefix; emp_var_temp := emp_var_prefix ||i;

INSERT INTO EMPLOYEE TABLE ('EMPLOYEE_NAME', 'CITY') values ('emp_var_temp', '');

DBMS_OUTPUT.PUT_LINE(emp_var_temp); end loop;

END;

DECLARE
  emp_var_prefix varchar2(12) := 'QATEST';
  emp_var_temp varchar2(12) := '';
  city constant varchar(30) := 'dallas'

begin
  DBMS_OUTPUT.ENABLE;
  for i in 1..2 loop
    emp_var_temp  := emp_var_prefix;
    emp_var_temp := emp_var_prefix ||i;

    INSERT INTO EMPLOYEE TABLE ('EMPLOYEE_NAME', 'CITY') values ('emp_var_temp', '<what should I put here for constant dallas for city name>');
  
    DBMS_OUTPUT.PUT_LINE(emp_var_temp);
  end loop;

END;

I am new to PL SQL Code and need help writing Insert query statement . eg: I want to insert Employee in Employees table where only employee name changes but the city is constant. DECLARE emp_var_prefix varchar2(12) := 'QATEST'; emp_var_temp varchar2(12) := ''; city constant varchar(30) := 'dallas'

begin DBMS_OUTPUT.ENABLE; for i in 1..2 loop emp_var_temp := emp_var_prefix; emp_var_temp := emp_var_prefix ||i;

INSERT INTO EMPLOYEE TABLE ('EMPLOYEE_NAME', 'CITY') values ('emp_var_temp', '');

DBMS_OUTPUT.PUT_LINE(emp_var_temp); end loop;

END;

I am new to PL SQL Code and need help writing Insert query statement . eg: I want to insert Employee in Employees table where only employee name changes but the city is constant.

DECLARE
  emp_var_prefix varchar2(12) := 'QATEST';
  emp_var_temp varchar2(12) := '';
  city constant varchar(30) := 'dallas'

begin
  DBMS_OUTPUT.ENABLE;
  for i in 1..2 loop
    emp_var_temp  := emp_var_prefix;
    emp_var_temp := emp_var_prefix ||i;

    INSERT INTO EMPLOYEE TABLE ('EMPLOYEE_NAME', 'CITY') values ('emp_var_temp', '<what should I put here for constant dallas for city name>');
  
    DBMS_OUTPUT.PUT_LINE(emp_var_temp);
  end loop;

END;
Source Link

How to use PL SQL Constants in Insert statement

I am new to PL SQL Code and need help writing Insert query statement . eg: I want to insert Employee in Employees table where only employee name changes but the city is constant. DECLARE emp_var_prefix varchar2(12) := 'QATEST'; emp_var_temp varchar2(12) := ''; city constant varchar(30) := 'dallas'

begin DBMS_OUTPUT.ENABLE; for i in 1..2 loop emp_var_temp := emp_var_prefix; emp_var_temp := emp_var_prefix ||i;

INSERT INTO EMPLOYEE TABLE ('EMPLOYEE_NAME', 'CITY') values ('emp_var_temp', '');

DBMS_OUTPUT.PUT_LINE(emp_var_temp); end loop;

END;