Comma separated values for input and return multiple values
Hello everyone,
I have this simple package. Can someone suggest a way to accept multiple empno as input (comma separated) and to return set of salary values for the set of employee numbers (compatible to work with lower Oracle versions). Thanks much!
CREATE OR REPLACE PACKAGE test_multi IS
FUNCTION GET_sal(P_empno IN emp.empno%TYPE) RETURN NUMBER;
END test_multi;
CREATE OR REPLACE PACKAGE BODY test_multi IS
FUNCTION GET_sal(P_empno IN emp.empno%TYPE) RETURN NUMBER IS
V_sal NUMBER(10,2);
MSG VARCHAR2(200);
BEGIN
SELECT sal
INTO V_sal
FROM emp
WHERE empno = p_empno;
RETURN V_sal;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No data found.');
IF (V_sal IS NULL OR V_sal = 0) THEN
V_sal := 0;
END IF;
RETURN V_sal;
WHEN OTHERS THEN
MSG := SUBSTR(SQLERRM, 1, 70);
DBMS_OUTPUT.PUT_LINE(MSG);
END GET_sal;
END test_multi; -- End package
A way to do this in 10g or above...
SQL> ed
Wrote file afiedt.buf
1 with e as (select '7499,7698,7654,7902' as enos from dual)
2 --
3 select empno, sal
4 from emp
5 where empno in (select regexp_substr(enos,'[^,]+',1,rownum)
6 from e
7* connect by rownum <= length(regexp_replace(enos,'[^,]'))+1)
SQL> /
EMPNO SAL
7902 3000
7698 2850
7654 1250
7499 1600
SQL>As for Oracle 8, .... well.... like Oracle, I no longer use unsupported versions, so I'd recommend you upgrade to something that is supported.
Similar Messages
-
Get Variant Attribute Should Search for and return multiple values based on RegEx
I am using Variants as lookup tables (see this article):
Using Variant Attributes to Build a Dictionary or Look-up Table
I would like to be able to use some sort of wildcard to return multiple results from the Get Variant Attribute VI (all results are of the same type, and I don't know the exact names of all the results - those two points make this idea distinct from this idea: Set/Get Variant Attribute for Multiple Attributes).
Ideally the wildcard would be RegEx. If it were, the means by which you specify what to return is standardized.
In the above example, there would be some ambiguity in terms of whether or not you would want to return a result or an array of results given an input, and I doubt you could detect and assume RegEx is what the programmer desires to use. So I think this means a new input would be required to specify whether or not the "name" input of the Get Variant Attribute VI should be interpreted as a RegEx query.
Why RegEx? Why not SQL query? Why not filename wildcard matching?
I don't see anything that makes RegEx special. For this kind of functionality, the code that you've written seems like exactly the right way to do it rather than bolting a RegEx parser or any other system into the primitives or clouding the palette with a bunch of primitives to support various search functions. I could see a primitive that takes a VI refnum that has a conpane of string in/boolean out that you would pass in to supply the filter functionality that you want for any given application, but even that I'd lean toward just letting that be a library that someone writes on top of the primitives. Yes, there is some memory reduction that can be done if it is internal to the primitives, no question about that. But there are so many variations in how to do that filtration/sorting/etc that I'm not confident that any prim would cover a sufficient use case to be worth it. I could be wrong here ... let's see what other comments come in. -
Search and return multiple value.
Hello!
I have a little problem that I need help with. It's a little complicated so bare with me.
I have multiple tables of Income for different people. The table is like this
Table Name: A's Income
Date ........ Amount
5/1/09 .... 5.55
5/3/09 .... 7.89
5/3/09 .... 8.90
5/7/09 .... 3.45
I created a new table to log down each day income across every person's table. So it's something like this
Table Name: Total Income by Date
Date ....... Amount
5/1/09 ... = Income of A + B + C, etc.
5/2/09 ... = " "
5/3/09 ... = etc.
5/4/09
5/5/09
5/6/09
5/7/09
So here's the formula for the Amount under the Total Income by Date table
=IF(Date = IFERROR(LOOKUP(Date, A's Income :: Date), 0), LOOKUP(Date,A's Income :: Date,A's Income :: Amount), 0)
That's only for one person (A) I would add the rest into the formula, but the problem is that if Person A has multiple income logged for the same date like the first table (5/3 - 7.89 & 5/3 - 8.90) the LOOKUP(Date,A's Income :: Date,A's Income :: Amount) only return the first value it finds. Is there a function or method I could do to return both value together? I tried SUMIF(A's Income :: Date, "= Date", A's Income :: Amount)
If there needs to be any clearing up please tell me.
Thanks a lot.
Message was edited by: Douten
Message was edited by: Douten
Message was edited by: DoutenWow thank you so much!! I never knew the answer was that simple. I thought that if we wanted to use SUMIF it would have to be SUMIF(A's income :: $A,"= A",A's income :: B). I never tried your solution. Thanks a lot again!
Can you explain a little bit more on your B ("Sum") Column? I'm still new to excel programs, why did you do =SUM(OFFSET($A$1,ROW()-1,2,1,COLUMNS(2:2)-2)), instead of something like SUM(C,D)?
Thanks -
What are the optimal values for mac and arp timeout values
Hi Guys.
What are the best values for "mac address-table aging-time" and "arp timeout" by following scenarios?:
- single sg300-10 as layer3-switch with a maximum of 10 local (direct connected) hosts
- and a 3750x-stack with 100 local hosts + hsrp with a other stack of the same sort
or for asa 5520 as internet gateway for 500 clients?
I use at the moment a mac aging-time from 300 seconds and a arp timeout from 3600 seconds.
Is this o.k.?
Thanks.Marvel.
As far as enhancing the CLI, it will of course be enhanced when new firmware releases provide new features. As far as making it more IOS-like, best to my knowledge, no. The only other supported CLI on the SB switches are on the SX500 series and SX200E series which the CLI are all consistent. If you bought a SX500 series the commands are nearly identical minus the different feature sets.
-Tom
Please mark answered for helpful posts -
UPDATE statement based on query and return multiple value
Hi everybody,
I have two tables: temp3 and temp
One of them (temp3) should be updated based on the query where clause (id and flag columns).
I run this query but it updates all of the records in the temp3. I want to update only records with 'UPDATED' flag.
update temp3 t3
set (id,name,address) = (select t.id, t.name, t.address from temp t, temp3 t3
where t.id = t3.id and t.flag = 'UPDATED');
Does any body know how I can do it?
I appreciate your help
ThxHello
Basically you're missing a where clause on your update statement to restrict rows in t3 to the ones that have a corresponding row in t1.
SQL> select * from dt_test_t1;
ID NAME ADDRESS ROW_STATUS
1 Joseph Bloggs Some street UPDATED
1 Joe Bloggs Old street OLD
2 Fredrick Bloggs New street UPDATED
2 Fred Bloggs Some street OLD
3 Robert Bloggs Better street UPDATED
3 Bob Bloggs Some street OLD
100 Barry Bethel Some street UPDATED
200 Giles Brandreth Some street UPDATED
8 rows selected.
SQL> select * from dt_test_t3;
ID NAME ADDRESS ROW_STATUS
1 Joe Bloggs Old street
2 Fred Bloggs Some street
3 Bob Bloggs Some street
4 Joe Smith Some street
5 John Doe Some street
--this update as it stands does not work as it updates rows to have
--null name and address where there is not a proper matching row in
--t1
SQL> UPDATE
2 dt_test_t3 t3
3 SET
4 ( t3.name,
5 t3.address,
6 t3.row_status
7 ) = (SELECT
8 t1.name,
9 t1.address,
10 t1.row_status
11 FROM
12 dt_test_t1 t1
13 WHERE
14 t1.id = t3.id
15 AND
16 t1.row_status = 'UPDATED'
17 );
5 rows updated.
SQL> select * from dt_test_t3;
ID NAME ADDRESS ROW_STATUS
1 Joseph Bloggs Some street UPDATED
2 Fredrick Bloggs New street UPDATED
3 Robert Bloggs Better street UPDATED
4
5
SQL> rollback;
Rollback complete.
--Now add in the where clause to make sure we're only updating rows in
--t3 that have a corresponding row in t1:
SQL> UPDATE
2 dt_test_t3 t3
3 SET
4 ( t3.name,
5 t3.address,
6 t3.row_status
7 ) = (SELECT
8 t1.name,
9 t1.address,
10 t1.row_status
11 FROM
12 dt_test_t1 t1
13 WHERE
14 t1.id = t3.id
15 AND
16 t1.row_status = 'UPDATED'
17 )
18 WHERE
19 EXISTS( SELECT
20 NULL
21 FROM
22 dt_test_t1 t1
23 WHERE
24 t1.id = t3.id
25 AND
26 t1.row_status = 'UPDATED'
27 );
3 rows updated.
SQL> select * from dt_test_t3;
ID NAME ADDRESS ROW_STATUS
1 Joseph Bloggs Some street UPDATED
2 Fredrick Bloggs New street UPDATED
3 Robert Bloggs Better street UPDATED
4 Joe Smith Some street
5 John Doe Some streetHTH
David -
How to hide a varible that is ready for input and personalized for a value
Hi All,
Is there anyway to hide a variable in variable screen selection which is ready for input and its personalized value is stored in the ODS.
Any help greatly appreciated.
Suresh.Hi Roberto,
Is there anyway to hide that variable from the variable screen(with still option being selected as ready for input).I ried all the options such as replacemetn type & copy from another variable.Always it appears in the varaible screen.
I don't want user to change the value of this variable.
Cheers,
Suresh. -
Return multiple values from dynamic lov in apex 3.2.1
Hi
I need to create a dynamic lov that displays multiple values from a table and RETURNS multiple values into display only fields in a form page to be saved to the database
For example
dynamic list of value name SERVER
select name || ',' || life_cycle d, name r
from sserver
order by 1
This SERVER LOV is attached to the P4_SSERVER_NAME field in the form.
However this only returns sserver. name into the P4_SSERVER_NAME field in the form. I would need to capture the life_cycle field as well and populate the P4_LIFE_CYCLE field in the form as well. How does one do this?
I have searched this forum however could not find a thread that fit my situation. i saw that in 4.2 there is dynamic action however unable to upgrade at this moment.
any suggestions are greatly appreciated.
thank youHi CRL,
One method is to set the value of your P4_LIFE_CYCLE item via APEX_UTIL.set_session_state
To do this you need to create a Page Process
Type PL/SQL anonymous block
Process Point On Load - Before Header
The source for the Process might look like this: DECLARE
l_life_cycle VARCHAR2 (50);
BEGIN
SELECT life_cycle
INTO l_life_cycle
FROM sserver
WHERE :p4_sserver_name = sserver.name;
APEX_UTIL.set_session_state ('P4_LIFE_CYCLE', l_life_cycle);
END;Jeff -
How will get subquery return multiple values and passing to the main query
Hi all ;
here i given one sql query
1)select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '|| initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
b.name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
from table1 a
join table3 c on c.emptype = a.emptype
left outer join table2 b on a.name = b.name
where a.mgrid = 100;
if i run this above query returning multiple values depend on sa.mgr values.
like output coming like this
[yes]:2000-anbarasan
[yes]:2700-anb
[yes]:2000-rasan
[yes]:2807-anbarasan
[yes]:2700-anbanu
[yes]:2000-null
2) this sub query i am passing with main query
select sa.mgrid,sa.sal,(select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '||
initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
b .name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
from table1 a
join table3 c on c.emptype = a.emptype
left outer join table2 b on a.name = b.name
where a.mgrid = 100)" test " from table4 sa,table5 te ,table6 ft where sa.id(+)=te.id and sa.mgr=ft.mgr;
my final out put required like this:
mgrid sal test
100 20000 [yes]:2000-anbarasan
[yes]:2700-anb
[yes]:2000-rasan
[yes]:2807-anbarasan
[yes]:2700-anbanu
[yes]:2000-null
but i am getting erro:
1)missing paranths-it solved
2)single row subquery return more then one row.
give me the correct solution.how will solve this problem
Edited by: anbarasan on Sep 29, 2008 6:49 AM
Edited by: anbarasan on Sep 29, 2008 6:51 AM
Edited by: anbarasan on Sep 29, 2008 6:53 AM
Edited by: anbarasan on Sep 29, 2008 6:56 AM
Edited by: anbarasan on Sep 29, 2008 6:58 AMHi,
It doesn't look like you posted either the complete query or the complete error message (including line number). Try again.
"single row subquery return more then one row" usually means you are using a sub-query in a place where a single expression is expected, for example the column called avg_sal in this query:
SELECT ename
, sal
, (SELECT AVG (sal) FROM scott.dept WHERE deptno = e.deptno) AS avg_sal -- Scalar-sub-query
FROM scott.emp e; The error occurs when the sub-query returns more than one row
If the sub-querry really is supoosed to be returning only one row, the solution is to fix the sub-query, usually be adding something to the WHERE clause.
If the sub-query is supposed to return more than one row, then the main query has to be re-written, perhaps as a join.
Post a little sample data and the results you want from that data if you need help. -
Hi how will get subquery returns multiple values for main query
Hi all ;
here i given one sql query
1)select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '|| initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
b.name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
from table1 a
join table3 c on c.emptype = a.emptype
left outer join table2 b on a.name = b.name
where a.mgrid = 100;
if i run this above query returning multiple values depend on sa.mgr values.
like output coming like this
yes:2000-anbarasan
yes:2700-anb
yes:2000-rasan
yes:2807-anbarasan
yes:2700-anbanu
yes:2000-null
2) this sub query i am passing with main query
select sa.mgrid,sa.sal,(select decode(a.FLG,'Y','yes','N','no','null')||'] '||a.p_type||' : '||
initcap(replace(substr(b.mgr,0,instr(b.mgr,'@')-1),'.',' '))||' - '||
b .name||' ('|| substr(a.name,0,instr(a.name,'-')-1)||')'
from table1 a
join table3 c on c.emptype = a.emptype
left outer join table2 b on a.name = b.name
where a.mgrid = 100)" test " from table4 sa,table5 te ,table6 ft where sa.id(+)=te.id and sa.mgr=ft.mgr;
my final out put required like this:
mgrid sal test
100 20000 yes:2000-anbarasan
yes:2700-anb
yes:2000-rasan
yes:2807-anbarasan
yes:2700-anbanu
yes:2000-null
but i am getting erro:
1)missing paranths
2)single row subquery return more then one row.
hi kindly give me answer to me as soon as possible
Edited by: anbarasan on Sep 29, 2008 9:48 PMI refuse to read all of that code and guess what error message you are getting. Apparently others feel the same way.
Run the final SQL statement and then cut and paste the code and full error statement into a post.
Also include your full version number to three decimal places.
My refusal is not an unwillingness to help you but rather an unwillingness to spend 10 minutes reconstructing what you could have pasted in in a fraction of a second. We are all volunteers here and there are many people that need help. I hope you understand. -
[UIX] How To: Return multiple values from a LOV
Hi gang
I've been receiving a number of queries via email on how to return multiple items from a LOV using UIX thanks to earlier posts of mine on OTN. I'm unfortunately aware my previous posts on this are not that clear thanks to the nature of the forums Q&A type approach. So I thought I'd write one clear post, and then direct any queries to it from now on to save me time.
Following is my solution to this problem. Please note it's just one method of many in skinning a cat. It's my understanding via chatting to Oracle employees that LOVs are to be changed in a future release of JDeveloper to be more like Oracle Forms LOVs, so my skinning skills may be rather bloody & crude very soon (already?).
I'll base my example on the hr schema supplied with the standard RDBMS install.
Say we have an UIX input-form screen to modify an employees record. The employees record has a department_id field and a fk to the departments table. Our requirement is to build a LOV for the department_id field such that we can link the employees record to any department_id in the database. In turn we want the department_name shown on the employees input form, so this must be returned via the LOV too.
To meet this requirement follow these steps:
1) In your ADF BC model project, create 2 EOs for employees and departments.
2) Also in your model, create 2 VOs for the same EOs.
3) Open your employees VO and create a new attribute DepartmentName. Check selected in query. In expressions type (SELECT dept.department_name FROM departments dept WHERE dept.department_id = employees.department_id). Check Updateable always.
4) Create a new empty UIX page in your ViewController project called editEmployees.uix.
5) From the data control palette, drag and drop EmployeesView1 as an input-form. Notice that the new field DepartmentName is also included in the input-form.
6) As the DepartmentName will be populated either from querying existing employees records, or via the LOV, disable the field as the user should not have the ability to edit it.
7) Select the DepartmentId field and delete it. In the UI Model window delete the DepartmentId binding.
8) From the data controls palette, drag and drop the DepartmentId field as a messageLovInput onto your page. Note in your application navigator a new UIX page lovWindow0.uix (or similar) has been created for you.
9) While the lovWindow0.uix is still in italics (before you save it), rename the file to departmentsLov.uix.
10) Back in your editEmployees.uix page, your messageLovInput source will look like the following:
<messageLovInput
model="${bindings.DepartmentId}"
id="${bindings.DepartmentId.path}"
destination="lovWindow0.uix"/>Change it to be:
<messageLovInput
model="${bindings.DepartmentId}"
id="DepartmentId"
destination="departmentsLov.uix"
partialRenderMode="multiple"
partialTargets="_uixState DepartmentName"/>11) Also change your DepartmentName source to look like the following:
<messageTextInput
id=DepartmentName
model="${bindings.DepartmentName}"
columns="10"
disabled="true"/>12) Open your departmentsLov.uix page.
13) In the data control palette, drag and drop the DepartmentId field of the DepartmentView1 as a LovTable into the Results area on your page.
14) Notice in the UI Model window that the 3 binding controls have been created for you, an iterator, a range and a binding for DepartmentId.
15) Right click on the DepartmentsLovUIModel node in the UI Model window, then create binding, display, and finally attribute. The attribute binding editor will pop up. In the select-an-iterator drop down select the DepartmentsView1Iterator. Now select DepartmentName in the attribute list and then the ok button.
16) Note in the UI Model you now have a new binding called DCDefaultControl. Select this, and in the property palette change the Id to DepartmentName.
17) View the LOV pages source, and change the lovUpdate event as follows:
<event name="lovSelect">
<compound>
<set value="${bindings.DepartmentId.inputValue}" target="${sessionScope}" property="MyAppDepartmentId" />
<set value="${bindings.DepartmentName.inputValue}" target="${sessionScope}" property="MyAppDepartmentName" />
</compound>
</event>18) Return to editEmployees.uix source, and modify the lovUpdate event to look as follows:
<event name="lovUpdate">
<compound>
<set value="${sessionScope.MyAppDepartmentId}" target="${bindings.DepartmentId}" property="inputValue"/>
<set value="${sessionScope.MyAppDepartmentName}" target="${bindings.DepartmentName}" property="inputValue"/>
</compound>
</event>Thats it. Now when you select a value in your LOV, it will return 2 (multiple!) values.
A couple things to note:
1) In the messageLovInput id field we dont use the .path notation. This is mechanism for returning 1 value from the LOV and is useless for us.
2) Again in the messageLovInput we supply _uixState as an entry in the partialTargets.
3) We are relying on partial-page-refresh functionality to update multiple items on the screen.
Im not going to take the time out to explain these 3 points, but its worthwhile you learning more about them, especially the last 2, as a separate exercise.
One other useful thing to do is, in your messageLovInput, include as a last entry in the partialTargets list MessageBox. In turn locate the messageBox control on your page (if any), and supply an id=MessageBox. This will allow the LOV to place any errors raised in the MessageBox and show them to the user.
I hope this works for you :)
Cheers,
CM.Thanks Chris,
It took me some time to find the information I needed, how to use return multiple values from a LOV popup window, then I found your post and all problems were solved. Its working perfectly, well, almost perfectly.
Im always fighting with ADF-UIX, it never does the thing that I expect it to do, I guess its because I have a hard time letting go of the total control you have as a developer and let the framework take care of a few things.
Anyway, I'm using your example to fill 5 fields at once, one of the fields being a messageChoice (a list with countries) with a LOV to a lookup table (id , country).
I return the countryId from the popup LOV window, that works great, but it doesn't set the correct value in my messageChoice . I think its because its using the CountryId for the listbox index.
So how can I select the correct value inside my messageChoice? Come to think of it, I dont realy think its LOV related...
Can someone help me out out here?
Kind regards
Ido -
Do I need to extend any of classes from AXIS to return multiple values?
Do I need to extend any of classes from AXIS to return multiple values? I'm exposing the following method as web service through AXIS to return multiple values.
public ContactAddress testService()
ContactAddress cAddr = new ContactAddress();
cAddr.setAddresses1("AAAAAAAAAAAAA");
cAddr.setAddresses2("BBBBBBBBBBBBB");
cAddr.setAddresses3("CCCCCCCCCCCCC");
return cAddr;
and the code for ContactAddress is
public class ContactAddress {
// member variables
private String addresses1;
private String addresses2;
private String addresses3;
public String getAddresses1() {
return addresses1;
public void setAddresses1(String addresses1) {
this.addresses1 = addresses1;
public String getAddresses2() {
return addresses2;
public void setAddresses2(String addresses2) {
this.addresses2 = addresses2;
public String getAddresses3() {
return addresses3;
public void setAddresses3(String addresses3) {
this.addresses3 = addresses3;
}when I'm exposing the method in following way...I'm gettting this error.
org.xml.sax.SAXParseException: Premature end of file.
The wsdl for this is .......
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://v:9090/services/Test" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://v:9090/services/Test" xmlns:intf="http://v:9090/services/Test" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
- <wsdl:types>
- <schema targetNamespace="http://v:9090/services/Test" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="ContactAddress">
- <sequence>
<element name="addresses1" nillable="true" type="soapenc:string" />
<element name="addresses2" nillable="true" type="soapenc:string" />
<element name="addresses3" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
- <wsdl:message name="addRequest">
<wsdl:part name="x" type="soapenc:string" />
</wsdl:message>
- <wsdl:message name="testServiceResponse">
<wsdl:part name="testServiceReturn" type="impl:ContactAddress" />
</wsdl:message>
- <wsdl:message name="addResponse">
<wsdl:part name="addReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:message name="testServiceRequest" />
- <wsdl:portType name="TestService">
- <wsdl:operation name="testService">
<wsdl:input message="impl:testServiceRequest" name="testServiceRequest" />
<wsdl:output message="impl:testServiceResponse" name="testServiceResponse" />
</wsdl:operation>
- <wsdl:operation name="add" parameterOrder="x">
<wsdl:input message="impl:addRequest" name="addRequest" />
<wsdl:output message="impl:addResponse" name="addResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="TestSoapBinding" type="impl:TestService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="testService">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="testServiceRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.avon.com" use="encoded" />
</wsdl:input>
- <wsdl:output name="testServiceResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://v:9090/services/Test" use="encoded" />
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="add">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="addRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://services.avon.com" use="encoded" />
</wsdl:input>
- <wsdl:output name="addResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://v:9090/services/Test" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="TestServiceService">
- <wsdl:port binding="impl:TestSoapBinding" name="Test">
<wsdlsoap:address location="http://v:9090/services/Test" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>1. The export button is only for use with Single Edition publications, for customers who are not using Creative Cloud.
2. All DPS issues are hosted by Adobe, you cannot host them on your own server.
3. The DPS pricing model is based around a per-issue download charge. There is no way to distribute content with DPS and avoid that charge.
Neil -
How to return multiples values useing functions
Hi to all,
I am using functions to return multiple values of two rows or multiple rows.
For example emp id = 100 and i need to return the value for this(empid) input and output of this first_name and salary.
I am tried in this way below but got errors (ORA-00932: inconsistent datatypes: expected NUMBER got HR.EMP_TYPE)
create or replace type emp_type as object(first_name varchar2(20),salary number);
create or replace function f1(empid in number)
return emp_type
as
emp_record emp_type;
begin
select first_name,salary into emp_record.first_name,emp_record.salary from employees where employee_id = empid ;
return emp_record;
end;
select f1(100) from dual;Sql is Sql and plsql is plsql. Though we can almost use all the sql objects inside a plsql code but vice versa is not always possible. Since plsql is tightly integrated with sql , if you return a number/date/varchar2 datatype values from plsql code to sql code,there is nothing wrong .Sql acknowledges this return type and knows well about how to handle it .But plsql record is a plsql specific datatype ,oracle was not built keeping in mind the fact that people will be creating difference types of records in plsql .So if you return a plsql datatype into a sql statement (which is processed by a sql engine) ,you need to tell oracle that I have written a plsql code which is going to return a record type so that sql engine can interpret it well.
So all you need to do is create record in sql (known as object in sql ),when you make one, the entry is going to be shown in user_types views. Now use it like any other data type. I assume that the forum link provided in the above post is the best one to understand.
Thanks,
Rahul -
Returning multiple values from a table
Hi there i am working on a bit of sql which will return values when they exist in a table.
The code I have returns the correct value when there is only one entry in the tbl_studentmodules table, as soon as there is more than one entry in this table it displays no rows at all :(.
Can anyone point out how I go about returning multiple values?
select modulename from tbl_modulefeedback
where 1 = (select count(*) from tbl_studentmodules
where upper(:APP_USER) = upper(student_id))
and 1 = (select count(*) from tbl_modulefeedback, tbl_studentmodules
where tbl_modulefeedback.modulecode = tbl_studentmodules.modulecode)Thanks in advance!
AshleighI'm not quite sure I understand what you are looking for, but I think a simple join may be what you need. something like:
select modulename
from tbl_modulefeedback mfb
join tbl_studentmodules sm
on mfb.modulecode = sm.modulecode
where upper(sm.student_id) = upper(:APP_USER)This will return the module name for all modules that the given student has provided feeedback for. If there is a possibility that a student/module combination could appear in tbl_studentmodules more than once, something like this might be better to show the modulename only once.
select modulename
from tbl_modulefeedback mfb
where mfb.modulecode in (select sm.modulecode
from tbl_studentmodules sm
where mfb.modulecode = sm.modulecode and
upper(sm.student_id) = upper(:APP_USER))If this is not what you want, then post some sample data (preferrable in the form of insert statements or a with clause) and the results you expect rom that sample data.
John -
Return multiple values from a function to a SELECT statement
I hope I've provided enough information here. If not, just let me know what I'm missing.
I am creating a view that will combine information from a few tables. Most of it is fairly straightforward, but there are a couple of columns in the view that I need to get by running a function within a package. Even this is fairly straightforward (I have a function named action_date in a package called rp, for instance, which I can use to return the date I need via SELECT rp.action_date(sequence_number).
Here's the issue: I actually need to return several bits of information from the same record (not just action_date, but also action_office, action_value, etc.) - a join of the tables won't work here as I'll explain below. I can, of course, run a separate function for each statement but that is obviously inefficient. Within the confines of the view select statement however, I'm not sure how to return each of the values I need.
For instance, right now, I have:
Table1:
sequence_number NUMBER(10),
name VARCHAR(30),
Table2:
Table1_seq NUMBER(10),
action_seq NUMBER(10),
action_date DATE,
action_office VARCHAR(3),
action_value VARCHAR(60),
I can't simply join Table1 and Table2 because I have to do some processing in order to determine which of the matching returned rows I actually need to select. So the package opens a cursor and processes each row until it finds the one that I need.
The following works but is inefficient since all of the calls to the package will return columns from the same record. I just don't know how to return all the values I need into the SELECT statement.
CREATE VIEW all_this_stuff AS
SELECT sequence_number, name,
rp.action_date(sequence_number) action_date,
rp.action_office(sequence_number) action_office,
rp.action_value(sequence_number) action_value
FROM table1
Is there a way to return multiple values into my SELECT statement or am I going about this all wrong?
Any suggestions?
Thanks so much!Hi,
What you want is a Top-N Query , which you can do using the analytic ROW_NUMBER function in a sub-query, like this:
WITH got_rnum AS
SELECT action_seq, action_dt, action_office, action_type, action_value
, ROW_NUMBER () OVER ( ORDER BY action_date
, action_seq
, action_serial
) AS rnum
FROM table2
WHERE action_code = 'AB'
AND action_office LIKE 'E' -- Is this right?
SELECT action_seq, action_dt, action_office, action_type, action_value
FROM got_rnum
WHERE rnum = 1
;As written, this will return (at most) one row.
I suspect you'll really want to get one row for each group , where a group is defined by some value in a table to which you're joining.
In that case, add a PARTITION BY clause to the ROW_NUMBER function.
If you'd post a little sample data (CREATE TABLE and INSERT statements), I could show you exactly how.
Since I don't have your tables, I'll show you using tables in the scott schema.
Here's a view that has data from the scott.dept table and also from scott.emp, but only for the most senior employee in each department (that is, the employee with the earliest hiredate). If there happens to be a tie for the earliest hiredate, then the contender with the lowest empno is chosen.
CREATE OR REPLACE VIEW senior_emp
AS
WITH got_rnum AS
SELECT d.deptno
, d.dname
, e.empno
, e.ename
, e.hiredate
, ROW_NUMBER () OVER ( PARTITION BY d.deptno
ORDER BY e.hiredate
, e.empno
) AS rnum
FROM scott.dept d
JOIN scott.emp e ON d.deptno = e.deptno
SELECT deptno
, dname
, empno
, ename
, hiredate
FROM got_rnum
WHERE rnum = 1
SELECT *
FROM senior_emp
;Output:
. DEPTNO DNAME EMPNO ENAME HIREDATE
10 ACCOUNTING 7782 CLARK 09-JUN-81
20 RESEARCH 7369 SMITH 17-DEC-80
30 SALES 7499 ALLEN 20-FEB-81
By the way, one of the conditions in the query you posted was
action_office LIKE 'E'which is equivalent to
action_office = 'E'(LIKE is always equivalent to = if the string after LIKE doesn't contain any wildcards.)
Did you mean to say that, or did you mean something like this:
action_office LIKE 'E%'instead? -
How can I return multiple values with PL/SQL Web Services
Hi,
I'm new to developping Web Services. I'm doing some tests with JDeveloper and OC4J on my local machine with a Web Services based on a PL/SQL function within a package. Right now that function only returns one value. So the xml response only has one output.
I'd like to know how can I return multiple values with my PL/SQL Web Service. For example, if I want to return an employee's name and id? And that the xml contains two output : <employee>, <empid>?
Reginald
ps : I have searched the forum and I couldn't find an answer to this question, if that has been discussed AND answered before, can you please post the link? ThanksAlright, I actually found my answer. Since this was asked I think as a followup somewhere else I'll give my answer.
It is very simple, all you have to do is create an Object Type and then Return that object type. After that, JDeveloper will take care of everything and you will have an xml response with multiple values. Here
{color:#ff0000}
create or replace TYPE person AS OBJECT
( id_interv number,
first_name VARCHAR2(50),
last_name VARCHAR2(50),
date_birth date
);{color}
Then your function used in your Web Service should look something like this :
{color:#ff0000}
function info_emp (p_empno IN VARCHAR2) RETURN person AS
l_emp person := person(-1,'','','');
BEGIN
SELECT first_name
,last_name
,emp_no
INTO l_emp.first_name
,l_emp.last_name
,l_emp.emp_no
FROM emp
WHERE upper(emp_no) = upper (emp_no);
{color}
{color:#ff0000}
RETURN l_emp;
EXCEPTION WHEN NO_DATA_FOUND THEN
l_emp := person (-1,'n/a','n/a','n/a');
RETURN l_emp ;
END info_emp;{color}
{color:#ff0000}{color:#000000}After that, this is what the xml response looks like :{color}{color}
<first_name xsi:type="xsd:string">John</first_name>
<last_name xsi:type="xsd:string">Doe</last_name>
<emp_no xsi:type="xsd:string">0250193</emp_no>
Maybe you are looking for
-
Triggering RFC FM in R3 for the RFC to File scenario
Hi All, I am Developing a RFC-XI-FILE scenario where i am unable to triger an RFC from the source system(R/3) .I have used the RFC-FM : ZBAPI_COMPANY_GETDETAIL ( which is remote enable) i havent written any source code in the function module : jus
-
I'm looking to buy a new graphics card for my iBook, considering the one I have is only like 36mbs. Is every graphics card the same? Or are there different graphics cards needed for different computers? I guess what I'm asking is what graphics cards
-
RV042G FTP still goes through WAN1
I have created a protocol binding rule and even a bandwidth rule to make sure outgoing FTP needs to go through WAN2 interface. But it still goes through WAN1, it only works when I disconnect WAN1
-
Why I can not open the downloaded applications in my iphone 4s?
Why I can not open the downloads applications? Please show me the way.
-
HT3529 Has anyone experienced problems sending pictures on message today?
Has anyone experienced problems sending pictures on Imessage today? Even mail has been taking a long time to receive. I work near newark airport.