i have an interesting situation
here is my code
SELECT :dateSend, t.senderPostindex, t.recipientPostindex, d.shipment_days FROM TABLE t
INNER JOIN shipment_days d on d.first_index = t.senderIndex and d.second_index = t.recipientPostindex
WHERE t.senderPostindex = variablesenderPostindex AND t.recipientPostindex = variablerecipientPostindex
Basically, i need procedure like getShipmentDays('01001', '02031', '2020/05/09 15:40:00') and it have to return me
- dateSend: 2020/05/09 15:40:00
- senderPostindex: 01001
- recipientPostindex: 02031
- shipment_days: 5
I was trying to create this function, but honestly it's hard for me to understand it, could someone help me with that please? p.c. dateSend is a bind variable and i dont'e have it
One option is to create a procedure with
OUTparameters.As you didn't post test case, I created one by myself.
Your query converted to a procedure:
Testing: as there are several
OUTparameters, you have to declare variables to accept their values.Another option is to create a function which returns refcursor:
Or, as you wished, to use a table function.
Create types first:
Function:
Testing: