How to perform this procedure and get the result?
I created a procedure, the source code for the same thing is provided below.create or replace procedure vin_test (p_deptno in number
p_cursor ON SYS_REFCURSOR)
as
v_res Emp % rowtype;
Start
Open the p_cursor FOR
Select *.
WCP
where deptno = p_deptno;
end vin_test;
Now, if I want to see that the out put of this Proc
I first put the Serveroutput on and then...
Exec vin_test (10);
I get an error message indicating an incorrect number of arguments, then someone can tell me what is the value of the parameter I should move on so that I can get the desired output.
Thanks in advance
OraCrazy
In sqlplus you can do like this.
SQL> create or replace procedure vin_test( p_deptno IN number, p_cursor OUT SYS_REFCURSOR)
2 as
3 v_res Emp%rowtype;
4 begin
5 open p_cursor for
6 select *
7 from emp
8 where deptno = p_deptno;
9 end;
10 /
Procedure created.
SQL> var lcur refcursor
SQL> exec vin_test(30,:lcur)
PL/SQL procedure successfully completed.
SQL> print lcur
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO DIV
---------- ---------- --------- ---------- --------- ---------- ---------- ---------- ----------
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 10
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 10
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 10
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 10
7900 JAMES CLERK 7698 03-DEC-81 950 30 10
6 rows selected.
Thank you
Knani.
Tags: Database
Similar Questions
-
How to perform a function and return the result in a variable of liaison
Hello
I'm trying to calculate the sum of the salaries of all persons with a particular using a function JOB_ID TOTAL_INCOME (v_job_id).
create or replace function total_income
+ (v_job_id in VARCHAR2) +.
Number IS BACK
v_total number (6);
cursor get_sal is
Select the pay of employees
where job_id = v_job_id;
BEGIN
v_total: = 0;
for emp in get_sal
loop
v_total: = v_total emp.salary; +.
end loop;
dbms_output.put_line (' Total salary ' | v_job_id |' is: ' | v_total);
Return v_total;
END;
Now I woud like to perform this function and assign the value returned in a variable binding test_sal
test_sal variable number (6)
SELECT total_income ('AD_VP') in: test_sal FROM DUAL;
dbms_output.put_line (' Sal Total :'||: test_sal);
This returns the errors below:
SELECT total_income ('AD_VP') in: test_sal FROM DUAL
*+
Error on line 0
ORA-01036: illegal variable name/number
dbms_output.put_line (' Sal Total :'||: test_sal);
Error on line 3
ORA-00900: invalid SQL statement
Could someone help me what could be the problem? Thanks for your time...Hi Kiran and welcome to the forum,
You mix SQL and PL/SQL
It's the way in which SQL:
SQL> SELECT total_income('AD_VP') FROM DUAL; TOTAL_INCOME('AD_VP') --------------------- 123 1 row selected.
It comes to PL/SQL in SQL * more
SQL> variable test_sal number SQL> execute :test_sal := total_income('AD_VP') PL/SQL procedure successfully completed. SQL> exec dbms_output.put_line('Total Sal:'||:test_sal) Total Sal:123 PL/SQL procedure successfully completed
Concerning
Peter -
Windows Vista window Defender error
Window Defender suddenly turned off & now shows error0x800106ba. How to solve this problem and get it to turn back?
Hello
read this information on the Defender:
· If you use microsoft security essentials avg avira mcafee norton etc they disable the vista version of windows defender by default
the basics of Microsoft security has its own version of windows defender
and other anti-virus programs use their own particular type of application to scan for spyware and malware
It of nothing to worry and is the default action, which is designed for them to do
If the above does not apply to your machine to read the information on the below link on how to disable the windows defender service in vista or make an autostart to enable
and here is the method to remove it from startup in vista
http://www.groovypost.com/HOWTO/Microsoft/Vista/remove-Windows-Defender-from-Vista-system-startup/
and this is how you would normally activate or disable windows defender in vista from within defenders of own and options tools
http://www.groovypost.com/HOWTO/Microsoft/Vista/disable-Windows-Defender-for-Microsoft-Vista/
and read this information to microsoft:
Error message when you run Windows Defender: «Error 0x800106ba»
http://support.Microsoft.com/kb/931849
and if you need to change startup programs read this information on the other methods of doing it without using defender
using msconfig read this tutorial:
How to use MSCONFIG in Windows Vista
Here's how to use MSCONFIG in Windows Vista to disable some unnecessary programs that load automatically at startup
http://netsquirrel.com/Msconfig/msconfig_vista.html
and also try this FREE program Autoruns:
This utility, which has a knowledge of auto-starting locations of any startup monitor, shows you what programs configured to run at system startup or login and that the entries in the order of processing windows. These programs include those in your startup folder, Run, RunOnce, and other registry keys. You can configure Autoruns to show other locations, including Explorer shell, toolbar extensions, helper objects to the browser, Winlogon notifications, auto and many start-up services more
-
What should I do to cancel this program and get the refund?
What should I do to cancel this program and get the refund?
Please visit: https://helpx.adobe.com/creative-cloud/help/manage-cc-individual-membership.html
If it's subscription month. You can cancel this subscription form your adobe account:
Cancel your membership creative cloud
Otherwise please contact support:
Hope this will help you.
Concerning
Megha Rawat
-
How can I return it and get the right size stock photo that actually works to post 20 x 30
Hi Debbie,.
Once that the photos were allowed, they cannot be removed or not allowed.
Thus, you must make sure that the image you need for your projects. You can also check the size of the images before their approval.
Hope that answers your question.
~ David
-
It is not my fault that my hard drive has ended then why they won't let me install? It would be the 3rd time I installed because I had to wipe my hard drive last year due to a virus is not as if I was crazy with it. How is - that different from me dust off a disc and install it manually? I sent redsupport, but they have not yet responded. The telephone line will not help with anything related to my product so I can not literally put their hands on someone. I NEED for my work animation and can not afford to CC or a replacement.
How can I speed it up and get the product I own?
Thanks in advance.
In that case please contact customer service to obtain your activation account is reset.
-
Hello
I'm looking for the most obvious and simple, LabVIEW:
1. start the motor Teststand: FACT
2. get a list of SEQ files to run: FACT
3 - loop through the list to run each file follows:<- found="" some="" examples="" but="" i="" have="" some="" trouble="" with="" the="" uimessage="">->
4. get the result of the execution of the SEQ:<->->
5 retrieve the XML + name of the generated report file path:<- obviously="" not="">->
http://digital.NI.com/public.nsf/allkb/3D3B2358DF9B786B8625789500549A3B
Here's my current implementation:
David Koch
-
I'm looking for only column compare to my same target table as a table source.
My query:
Select case when column_name_s is null and column_name_t is not null
then "alter table GRADE_CONVERSION drop | column_name_t | ';'
When column_name_s is not null and column_name_t is null
then "alter table GRADE_CONVERSION add | column_name_s | ' ' || data_type_s | « ; »
else 'alter table modify GRADE_CONVERSION | column_name_t | ' ' || data_type_t | « ; »
alterations of the end
from (select s.column_name column_name_s, t.column_name column_name_t,
s.data_type data_type_s, t.data_type data_type_t
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'erhan.
and table_name = "GRADE_CONVERSION."
+ 1
full outer join
(select column_name, column_id, data_type
of all_tab_cols@database
where owner = 'sarigul.
and table_name = "GRADE_CONVERSION."
+ 6
on s.column_name = t.column_name
)
Tables:
Target table: table GRADE_CONVERSION in sarigul@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) Table source: Table GRADE_CONVERSION in erhan@database
LETTER_GRADE VARCHAR2 (2) GRADE_POINT NUMBER (3.2) MAX_GRADE NUMBER (3) MIN_GRADE NUMBER (3) CREATED_BY VARCHAR2 (30) CREATED_DATE DATE MODIFIED_BY VARCHAR2 (30) MODIFIED_DATE DATE want to see output that is similar to this * (please ignore the names of column here it's just a clear example :))
ALTER table Target_table change BOOK_ID Varchar2 (4);
ALTER table Target_table I addSBN_10 Varchar2(13), null;
ALTER table drop TITLE Target_table;
Erhan_toronto wrote:
1.I used src.nullable src_nullable and tgt.nullable tgt_nullable but only show Yes as below: but want to see the result as not null or null
ALTER table TEST_TARGET change the NUMBER of MAX_GRADE (3, 2) Yes
Ok. So it's all about the Yes and the no decoding to Default Null or Not Null, isn't it?
So, to test, change one of the table of sample for NOT NULL columns in the source table, and then run the following query:
with src as ( select src.table_name src_table_name, src.column_name src_col_name, src.data_type src_data_type, src.data_length src_data_len, src.data_precision src_data_precision, src.data_scale src_data_scale, src.nullable src_nullable from user_tab_columns src where table_name = 'TEST_SOURCE' ), tgt as ( select tgt.table_name tgt_table_name, tgt.column_name tgt_col_name, tgt.data_type tgt_data_type, tgt.data_length tgt_data_len, tgt.data_precision tgt_data_precision, tgt.data_scale tgt_data_scale, tgt.nullable tgt_nullable from user_tab_columns tgt where table_name = 'TEST_TARGET' ), col_details as ( select src.src_table_name, nvl(tgt.tgt_table_name, first_value(tgt_table_name) over(order by tgt_table_name nulls last)) tgt_table_name, src.src_col_name, src.src_data_type, src.src_data_len, src.src_data_precision, src.src_data_scale, src.src_nullable, tgt.tgt_col_name, tgt.tgt_data_type, tgt.tgt_data_len, tgt.tgt_data_precision, tgt.tgt_data_scale, tgt.tgt_nullable from src left outer join tgt on ( src.src_col_name = tgt.tgt_col_name ) ) select * from ( select case when tgt_data_type != src_data_type or tgt_data_len != src_data_len or tgt_data_precision != src_data_precision or tgt_data_scale != src_data_scale or src_nullable != tgt_nullable then 'alter table ' || tgt_table_name || ' modify ' || tgt_col_name || ' ' || src_data_type || ' (' || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') when tgt_col_name is null then 'alter table ' || tgt_table_name || ' add ' || src_col_name || ' ' || src_data_type || case when src_data_type in ('DATE') then null else case when src_data_type in ('VARCHAR', 'VARCHAR2') then nvl(to_char(src_data_len), ' ') || ') ' else decode(nvl(src_data_precision, -1), -1, null, nvl(to_char(src_data_precision), ' ') || ', ' || nvl(to_char(src_data_scale), ' ') || ')') end end || decode(src_nullable, 'NO', ' NOT NULL', ' DEFAULT NULL') end alter_statement from col_details ) where alter_statement is not null;
Erhan_toronto wrote:
2. when I run below under user sarigul and erhan I get the result as OWNER, TABLE_NAME, COLUMN_NAME DATA_TYPE... I have a link between two users. They have access to two tables.
- Select * from all_tab_columns
where owner = 'erhan' and table_name = "TEST_SOURCE."
- Select * from all_tab_columns
where owner = 'sarigul' and table_name = "TEST_TARGET."
Alright. This means that you both users are on the same database. Only change, you will have to do in the above query is so change user_tab_columns to all_tab_columns and add the OWNER predicate respectively with the clause.
-
Subtract two time_clock and get the result minutes
Hi Experts,
Nicely, I would subtract two type of time_clock that varcahr2 to the database and get the minutes of the result.
Data:
Select ' 08:00 ' as start_time_clock, 15:00 ' as the double end_time_clock
Union of all the
Select ' 09:00 ', 16:30 ' of the double
Expected result:
start_time_clock end_time_clock count_minutes
---------------- -------------- -------------
08:00 15:00 420
09:00 16:30 450
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - production
Thanks in advance
WITH dataset
AS (SELECT ' 08:00 ' AS start_time_clock, 15:00 ' AS end_time_clock)
OF THE DOUBLE
UNION ALL
SELECT ' 09:00 ', 16:30 ' DOUBLE)
SELECT (to_date (end_time_clock,'HH24:MI')-to_date(start_time_clock,'HH24:MI')) * 24 * 60))
Of THE dataset
-
Hello
I have a problem or two, three and so of...I'm using a Vista and a Windows 7 computer and both systems hide many different cards when it is installed to even the fact that I have are the only user with administrative privileges on both computers.
And I have to search all over the place for a few guides that can tell me how to:
(1) show all cards like c:/Users/name/*.*
(2) find the mainfolders diffirent behind all the diffirent Junction Points
The two all I can get is someone who tells me to go and Explore/Optins/show/mark ' display all the hidden files and folders and clear Hide protected OSfiles hide known file types names. "
(A Danish BONES that I use for my translations may not be accurate)That the two Don t unhide/Show map C:/Users and folders/files under this mainmap at all.
So, is there someone who can tell me how I get fuld kontrol and get all the cards and visible files on my private property paid og computers without telling me to try this ot try it?
(1) I'm sorry, but I don't know what you mean by "cards".
(2) to see the junction points in the files they point to and C:\Users\Name, open a command prompt window and type:
dir random Boulder computer Maven
Most Microsoft Valuable Professional -
How to perform this procedure. .pls help with example
/ * It displays a warning * /.
-How to remove this warning
CREATE PROCEDURE EMP_TITLE_GENERATOR (EMP_GENDER IN (1) TANK, EMP_TITLE OUT VARCHAR2)
IS
BEGIN
EMP_TITLE: = Decode(EMP_GENDER,'M','Mr','F','Ms','INVALID');
EXCEPTION
WHILE OTHERS THEN
DBMS_OUTPUT. PUT_LINE (SQLERRM);
END;
Published by: 923746 on April 18, 2012 19:58
Published by: 923746 on April 18, 2012 19:59Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options SQL> CREATE PROCEDURE EMP_TITLE_GENERATOR (EMP_GENDER IN VARCHAR2,EMP_TITLE OUT VARCHAR2) 2 IS 3 begin 4 select DECODE(EMP_GENDER,'M','Mr','F','Ms','INVALID') into emp_title from dual; 5 EXCEPTION 6 WHEN OTHERS THEN 7 dbms_output.put_line(sqlerrm); 8 END; 9 / Procedure created. SQL> set serveroutput on SQL> DECLARE 2 EMP_GENDER VARCHAR2(200); 3 EMP_TITLE VARCHAR2(200); 4 BEGIN 5 EMP_GENDER := 'F'; 6 7 EMP_TITLE_GENERATOR( 8 EMP_GENDER => EMP_GENDER, 9 EMP_TITLE => EMP_TITLE 10 ); 11 DBMS_OUTPUT.PUT_LINE('EMP_TITLE = ' || EMP_GENDER); 12 DBMS_OUTPUT.PUT_LINE('EMP_TITLE = ' || EMP_TITLE); 13 END; 14 / EMP_TITLE = F EMP_TITLE = Ms PL/SQL procedure successfully completed. SQL>
-
How to rewrite this query to get the correct results?
Friends,
DB: 9iR2
I need to get the name of the employee and the employee number that are not in the table of presence.
but this query is not the right answer.
Thank youselect e.eno,e.ename from empl e where e.eno not in (select a.eno from attendance a)
Depending on your data
SQL> create table attendance( 2 ENO VARCHAR2(5), 3 TDATE VARCHAR2(10), 4 IN_TIME VARCHAR2(6), 5 OUT_TIME VARCHAR2(6), 6 SHIFT_NO NUMBER(1)); Table created. SQL> create table empl( 2 ENO VARCHAR2(5), 3 ENAME VARCHAR2(75)); Table created. SQL> insert into empl values('11','AA'); 1 row created. SQL> insert into empl values('12','AB'); 1 row created. SQL> insert into empl values('13','AC'); 1 row created. SQL> insert into empl values('14','AD'); 1 row created. SQL> insert into empl values('15','AF'); 1 row created. SQL> insert into attendance values('11','23-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('14','24-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('11','25-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('13','23-3-2009','9.00','6.00',1); 1 row created. SQL> insert into attendance values('15','23-3-2009','9.00','6.00',1); 1 row created. SQL> commit; Commit complete. select e.eno,e.ename from empl e where not exists(select 1 from attendance a where a.eno=e.eno); ENO ENAME 12 AB
Twinkle
-
Run ViewObject of bean and get the result.
How can I run my bean ViewObject and get all the lines that jdev ViewObject Return.My Version is 11.1.1.5.0
I tried to use this way but his return 0 rows, but when I check through Toad query returns data.
DCIteratorBinding iter =
getDCBindingContainer () .findIteratorBinding (name);
iter.executeQuery ();
Row [] rowArray = iter.getAllRowsInRange ();
Thank you
Raul
Hello
Its solved now thanks.
DCIteratorBinding = voIterator
ADFUtils.findIterator ("MyVObject");
Object ViewObject = voIterator.getViewObject ();
object.setNamedWhereClauseParam ("id", String.valueOf (id));
voIterator.executeQuery ();
Row [] rowArray = voIterator.getAllRowsInRange ();
Thank youRaul
-
SQL how to use a variable and use the result as a reference for the name of the table
Hi all
I have new in the declaration of Oracle, sorry in advance if something is easy for you all. BTW, I have this scenario:
I have a table OL structured in this way:
Date - it contains dates, for example 11/01/2015
TableName - it contains strings, for example, OL1, OL2, OL3 and so on...
Then I have a different table, the name of these tables are of the same name in the table of the OL, so I have table table, OL1, OL2, OL3 table and so on. The structure of these tables is the same. And Yes.
table OL1
---------------------------------------------------------------
ID LAST NAME FIRST NAME PHONE
---------------------------------------------------------------
1 JOHN DOE 12345679
2 PAUL 111111122 TIBBS
table OL2
---------------------------------------------------------------
ID LAST NAME FIRST NAME PHONE
---------------------------------------------------------------
1 ANNA KRAIG (NULL)
NATHAN FRESHMANN 111111133 2
If the scenario is clear, I would like to retrieve the value (null), research in all the OL * tables by using the value of the OL table (tablename) max.
If I'm going to do these simple steps, I got the result:
Select max (TableName) OL
the result will be OL2
# I know not how to use the option set to avoid changing the table name in the sql statement all the time.
set mytable = 'OL2.
Select Name, family name
of & mytable
When the phone is null
Any idea?
Thank you very much in advance.
Hello
run immediately "select dt.log_id, obj.presentation_name, dl.begin_time
bulk collect into v_result_set
of ' | v_ol |' dt join internal ol_object obj on
DT.object_type_id = obj.object_type_id
inner join ol_chunk_log dl on
DT.log_id = DL.log_id
where dt.data_value is null';
dbms_output.put_line (v_ol);
end;
Correct the code such as:
run immediately "select dt.log_id, obj.presentation_name, dl.begin_time
of ' | v_ol |' dt join internal ol_object obj on
DT.object_type_id = obj.object_type_id
inner join ol_chunk_log dl on
DT.log_id = DL.log_id
where dt.data_value is null' bulk collect into v_result_set;
for i in v_result_set.first ... v_result_set. Last
loop
dbms_output.put_line ('LOG ID: ' | ) ( v_result_set.log_id (i)) ;
dbms_output.put_line (' NAME CLOSELY: ' |) v_result_set.presentation_name (i));
dbms_output.put_line (' START TIME: ' |) ( v_result_set.begin_time (i)) ;
end loop;
end;
Kind regards.
-
How to operate the user enter value query and get the result on the text element
Hello
I'm really beginning to JDeveloper and ADF, I want to execute the query below, before with forms, I just add: TEXT_NAME to enhance the users entries, what should I do now with ADF, really unclear question and I would be grateful all help with that.
Select
NVL (min (substr (a.StartTime, 1, 8)), 0) Service_Start_Time, nvl (sum (a.sessionvolume), 0) Total_Traffic_KB
Of
aaa_bill one
where
msid =: TEXT_ITEM
and starttime > = (select max (fee) FROM aaa_bill
where msid =: TEXT_ITEM and accountreason = 5);You can use a form of parameter ADF for this requirement.
https://blogs.Oracle.com/Shay/entry/combining_multiple_queries_and
Maybe you are looking for
-
Hi David, can you help me with a problem. My laptop does not start the administrator password fails and is disabling sistem with error code 55318068... THX, I hope that respond you!
-
Pavilion dv7-3165dx Entertainment notebook startup problem
When you turn on the system shows HP logo that goes to screen black cursor with [esc] so that it starts on the lower left corner of the screen. Who went and displays the system diagnostics. Show system information of F1, F2 to start test (done that)
-
How to find an official update to android 4.0 or 4.1?
Hello I bought my pre-installed android honeycomb tablet, I heard that the upgrade to ice is available online, but I could not find it. Someone tell me where to find the official online upgrade? Thank you!
-
Windows Explorer crashes when you try to open avi files
I can't open avi files as windows Explorer crashes, if I open even a folder with an AVI in it, then windows Explorer crashes. I tried to run the Mats_run_codec from microsoft, but it just says: I need to run dot_run_fx (box 2), but when I run it I ge
-
He continues to tell me bho.dll does not work how to fix this
my computer is slow real work and continues to tell me BHO.dll does not work and restore it. I don't know how he also said IE3. SH.exe is not working?