|
-
hi oraka6
for your first question, you cannot directly execute the function from SQL> execute....... like executing the procedure. but there is way to execute the function using Dbms package(sorry I dont remember it).
For your 2nd question, it depends where you are going to use the procedure. Like forms/report. you can call the procedure from the form assigning values from the FORMS. But when you run the from PL/SQL, you can do like this
CREATE OR REPLACE PROCEDURE new_emp
(v_ename emp.ename%TYPE)
IS
v_job emp.job%TYPE DEFAULT 'SALESMAN';
v_mgr emp.mgr%TYPE DEFAULT 7839;
v_sal emp.sal%TYPE DEFAULT 1000;
v_comm emp.comm%TYPE DEFAULT 0;
v_deptno emp.deptno%TYPE DEFAULT 30;
a number :=&a;
BEGIN
IF valid_deptno (a) THEN
INSERT INTO emp (empno, ename, job, mgr, sal, comm, deptno)
VALUES (seq_empno.nextval, v_ename, v_job, v_mgr, v_sal, v_comm, v_deptno);
END IF;
END;
this is only temporary solution or you call this proce' and pass the parameter to deptno. hope it helps
Murugs
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|