Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass multiple values ​​into a single parameter in PL/SQL

jalal hakkiSep 11 2024

Hello

I created an oracle function (A_QTECDE) for a sum of some order quantities, if I have a single order it goes through otherwise I get an error message:

select A_QTECDE ((select num_cde from cde_cli_lign where num_cde like '0008%'),1) from dual

ORA-01427: single-row subquery returns more than one row

Here is the function:

CREATE OR REPLACE FUNCTION CREATOR.A_QTECDE (
VNUM_CDE IN VARCHAR2,
VNUM_LIGN IN BINARY_INTEGER
)
RETURN BINARY_INTEGER
AS
qte BINARY_INTEGER;

begin

Select sum (NVL(QTE_T1, 0) + NVL(QTE_T2, 0) + NVL(QTE_T3, 0)) into qte

from CDE_CLI_LIGN

where num_cde in vnum_cde and num_lign=vnum_lign ;

return qte;

end A_qtecde;

Thanks for Your Help

Comments
Post Details
Added on Sep 11 2024
20 comments
896 views