No parameter issues with functions and processes in Oracle

Source: Internet
Author: User

The last time I encountered a small problem, I accurately described it as a design defect. Let's first look at the problem,

3. For DEPT and EMP tables, query the results in the following format and arrange the results in descending order of Department numbers and salaries. Process printing]
Department name employee name salary

Create or replace procedure up_getde (v_did number)
As
Cursor mycur is select D. dname as dname, E. ename as ename, E. Sal as Sal
From dept D, EMP E
Where D. deptno = E. deptno
Order by D. deptno, E. Sal DESC;

Begin

For I in mycur Loop
Dbms_output.put_line (I. dname | ''| I. ename |'' | I. Sal );
End loop;
End;

Last Execution Process: exec up_getde (0 );

 

There is a meaningless parameter v_did, Which is redundant. Today we found a solution ,,

If the function and stored procedure do not have parameters, the function name and stored procedure name should not be followed by an extension number (); otherwise, a compilation error is reported.

While the call always needs to add ()

Select E. Eid, E. uf_getyearsal () from newstaff e where E. eid = 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.