I need the procedure to give me the next solution: I will add two tables from another place into my tables (done), then I write a procedure to add a new value to the third table, that will be the first table + the second table. I have a problem when I execute the tables, maybe I'm doing something wrong and I would be glad if you could help me.
Also, I don't know how to use "cursor is" but if you could help me of an example with this, that would be awesome.
Sorry for my bad English, I'm trying to learn it just to be part of this community :)
I created the tab_ejercicio with three tables
create table tab_ejercicio
(FirstName, varchar2(45),Address, varchar2(45),Thing varchar2(100));
Then I bring the other tables into the first two tables of ejercicio
INSERT INTO tab_ejercicio (FirstName, Address)
SELECT T3.STREET_ADDRESS,t2.first_name
FROM HR.DEPARTMENTS t1,
HR.EMPLOYEES t2,
HR.LOCATIONS t3
WHERE T1.department_id = t2.DEPARTMENT_ID
AND t1.LOCATION_ID = t3.LOCATION_ID
and now the procedure
CREATE OR REPLACE PROCEDURE PRC_PALABRALONGITUD2(Palabra varchar2, palabra2 varchar2)
IS
NewWord varchar2(100);
Length number(8);
w number(1);
begin
Length:=len(Word);
w:=mod(Length,2);
if w = 0 then
NewWord:= Word2 || Word;
else
NewWord:= Word|| Word2;
end if;
insert
into tab_ejercicio (Thing)
values (NewWord);
end;
I have problems here, since I don't know how to do it well, but I thought it would be something like this, adding the tables I want to use in the procedure
execute PRC_PALABRALONGITUD2(FirstName,Address);
And finally lets print the tab so we can see I fail :(
select *
from tab_ejercicio;