How to query webservice datacontrol from bean
Hi all,
In Jdeveloper 11 I have a web-service based data-control. In order to perform some checks, I need to query that DC from within a bean. Only question is, how to do that?
If it were a 'normal' VO based DC I would use something like this:
DCBindingContainer bindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding iter = bindings.findIteratorBinding("EmployeesView1Iterator");
RowSetIterator rsi = iter.getRowSetIterator();
rsi.next();
Row row = rsi.getCurrentRow();
String s = (String)row.getAttribute(1);
But in this case the String s = (String)row.getAttribute(1); returns rubbish. The method in the DC I want to call takes a parameter as input, and returns one row.
Any help would be greatly appreciated.
Arno
Hi Frank,
I don't know what it returns, but the iterator I got in my example was the methodIterator. When I call the accessorIterator it does work. So, when I call row.getAttribute("soandso"); the correct data is returned to me.
Arno
Similar Messages
-
How to query Process Status from database in Project Server 2010
Hello All,
I am using Project Server 2010.
I need to query Process Status from SQL.
where can I find Process Status in Database.
Thanks,
RohitHi Rohit,
you will not be able to find this information in reporting DB - the only database queries are supported.
If you really want to go for an unsupported solution, you should be able to find related tables and how to join them in stored proc "MSP_WEB_SP_QRY_Statusing_ReadStatus" in published database.
Regards
Barbara
To increase the value of this forum, please mark the replies that helped to solve your issue as answer. If you find answers to questions from other forum participants to be helpful, please mark them as helpful. Your participation will help others to find
an appropriate solution faster. Thanks for your support! -
How to access Message bundle from beans??
Greetings i am new to JSF.
I want to access my message bundle from beans, anyone could tell me how to do it?
Also, i need my beans to obtain the url address of my servlet automatically, how can i do that?
Thanks for any help!Another alternative if using the <f:loadBundle> tag within your JSP is to do something like the following in your bean logic:
In a JSP:
<f:loadBundle basename="Resources" var="messages"/>
In Bean:
ExternalContext extContext = FacesContext.getCurrentInstance().getExternalContext();
// Obtains the Map containing the key/value pairs loaded by the loadBundle tag
Map messages = (Map) extContext.getRequestMap().get("messages");
As to the second question, I'm assuming you want the URL that invoked the current request? If so, look at ExternalContext.getRequestPathInfo() and ExternalContext.getRequestServletPath(). -
How to query package info from the server repo instead of local DB?
Greetings!
Is there an option in pacman to query the package info ( like -Si ) from the server repo instead of the local package database? Or maybe some additional program is needed for this?
Update: Maybe this can be done by downloading a fresh copy of package DB with -Sy, but how to specify a custom package DB file? Is this accomplished with --dbpath option? Say
pacman -Sy --dbpath /tmp/tmpdb
Last edited by nbd (2015-06-07 18:44:23)nbd wrote:
How could one interpret this?
[root@kw etc]# checkupdates | grep pcre
pcre
[root@kw etc]# pacman -Si pcre | grep Version
Version : 8.37-1
[root@kw etc]# pacman -Qi pcre | grep Version
Version : 8.37-1
[root@kw etc]#
Ok, after updating your original post and asking this question I understand what you are actually trying to do. The "local package database" generally refers to /var/lib/pacman/local, not /var/lib/pacman/sync, which is why it was unclear.
fakeroot pacman -Syb /tmp/tmpdb -i pcre
should do what you want, but be very careful never to install anything using that temporary database. Take a look at the checkupgrades script to see how it does things if you want to do more than just check remote package info. -
How to show one list from bean two times
Hi All,
I am using jdeveloper version 11.1.1.6.0.
I have a scenario where I want to bind list attribute from the my bean to two different talbes or iterators.
I want to show this list twice on the page.
If I keep both the tables then it shows only one of it.
<af:table value="#{myAccShoppingCartBean.favAccountList}"
columnResizing="disabled"
disableColumnReordering="true"
styleClass="carttbl" var="row"
rows="#{bindings.favAccountList1.rangeSize}"
emptyText="#{bindings.favAccountList1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.favAccountList1.rangeSize}"
width="877" horizontalGridVisible="false"
verticalGridVisible="false"
rowBandingInterval="0" id="tblCart"
binding="#{myAccShoppingCartBean.tblCartItems}"
inlineStyle="border:1px solid #000000;overflow:hidden !important;">
<af:column sortProperty="productSizeId"
sortable="false" visible="false"
id="c239">
<af:outputText value="#{row.productSizeId}"
id="ot2asdf"/>
</af:column>
</af:table>
<af:table value="#{myAccShoppingCartBean.favAccountList}"
columnResizing="disabled"
disableColumnReordering="true"
styleClass="carttbl" var="row"
rows="#{bindings.favAccountList1.rangeSize}"
emptyText="#{bindings.favAccountList1.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.favAccountList1.rangeSize}"
width="877" horizontalGridVisible="false"
verticalGridVisible="false"
rowBandingInterval="0" id="tblCart"
inlineStyle="border:1px solid #000000;overflow:hidden !important;">
<af:column sortProperty="productSizeId"
sortable="false" visible="false"
id="c239">
<af:outputText value="#{row.productSizeId}"
id="ot2asdf"/>
</af:column>
</af:table>How to show this list two times.
any help is apprciatedHi ,
Can I replace above posts table with iterator
Can I set value attribute for different iterators same from the bean.
like
<af:iterator value="#{myAccShoppingCartBean.favAccountList}" id="i1">second one like
<af:iterator value="#{myAccShoppingCartBean.favAccountList}" id="i2">How to solve this?
Is there any way to set same value to the different Iterators on the same page -
How to Query Multiple Fields from different Tables using Toplink Expression
Hi,
I am trying to prepare an Oracle Toplink Expression to qurey the multiple columns of different tables. the query as following. Please can anyone help?
SELECT CYCLE.CYCLE_ID,
CYCLE.ASPCUSTOMER_ID,
CYCLE.FACILITYHEADER_ID,
CYCLE.ADDUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME ADDUSERNAME,
CYCLE.ADDDATE,
CYCLE.LASTUPDATEUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME LASTUPDATEUSERNAME,
CYCLE.LASTUPDATEDATE,
CYCLE.CYCLENAME,
CYCLE.CYCLENUMBER,
CYCLE.DESCRIPTION
FROM CYCLE,ASPUSER ASP
WHERE CYCLE.ADDUSER = ASP.ASPUSER_ID
and then i want to send that expression to readAllObjects method as a parameter
Expression exp = (..............this is the required qurey expression...................)
Vector employees = session.readAllObjects(getClass(), exp);
thanks,You havent given any information on the mapping between Cycle and Asp. I presume there is a one to one mapping between them. Also it appears there is no "WHERE" clause to limit the number of cycles being retrieved. If that is the case then I presume you want to load all cycles in the system.
Thats just a clientSession.readAllObjects(Cycle.class). If you have indirection turned on the Asp should get loaded when you do a cycle.getAsp().
I presume that SQL you posted loads all the columns of CYCLE and ASP. If you are interested in a subset of CYCLE or ASP then you should do a ReportQuery or partial object read.
Hi,
I am trying to prepare an Oracle Toplink Expression
to qurey the multiple columns of different tables.
the query as following. Please can anyone help?
SELECT CYCLE.CYCLE_ID,
CYCLE.ASPCUSTOMER_ID,
CYCLE.FACILITYHEADER_ID,
CYCLE.ADDUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME ADDUSERNAME,
CYCLE.ADDDATE,
CYCLE.LASTUPDATEUSER,
ASP.FIRSTNAME || ' ' || ASP.LASTNAME
LASTUPDATEUSERNAME,
CYCLE.LASTUPDATEDATE,
CYCLE.CYCLENAME,
CYCLE.CYCLENUMBER,
CYCLE.DESCRIPTION
FROM CYCLE,ASPUSER ASP
WHERE CYCLE.ADDUSER = ASP.ASPUSER_ID
and then i want to send that expression to
readAllObjects method as a parameter
Expression exp = (..............this is the required
qurey expression...................)
Vector employees = session.readAllObjects(getClass(),
exp);
thanks, -
How to return ResultSet object from Bean to JSP
I have a Java Bean, in it I have ResultSet Object in a method. Now I want to send this ResultSet Object to the JSP.
very good advice, otherwise you will spread your sql exception handling over way too many places. Keep it centered, so you can be sure to close your connection, statement, resultset again. Otherwise your database and web application might all of a sudden stop responding.
-
How to disable a commandbutton from bean after closing a popup.
Hi,
I have a scenario where there is a popup with a button.On click of the button the popup must close and all the buttons in the parent page must be disabled.
I tried the following to disable the button in the parent page:
commandbutton1.setDisbled(true);
AdfFacesContext.getCurrentInstance().addPartialTarget(commandbutton1);
But it doesn't work.Am I missing something here ?
Thanks!
Rohitseems like the page is getting refreshed after your code..
Try keepng the button used to close the popup as partialSubmit="True" -
How to query uncommited transactions
Hi Does anyone know how to query Oracle database from SQL*Plus to view uncommitted transactions?
ThanksI noticed after I posted that I had used a package I found on the web called list that includes several useful functions. So in case someone wants it, here are the package and body:
***PACKAGE***
CREATE OR REPLACE PACKAGE list AUTHID CURRENT_USER IS
-- All of these functions and procedures have the following parameters:
-- list_in - A delimited list to be parsed.
-- delimiter - The delimiter to be used for parsing the list. Defaults
-- to a comma.
-- null_item - What to do with null items in the list. A null item is created
-- by consecutive occurances of the delimiter. Valid values are
-- 'KEEP' to allow items in the list to be null, or 'SKIP' to ignore
-- null items, ie. treat consecutive occurances of delimiters as a
-- single delimiter. The default is 'KEEP'.
-- delimiter_use - How the delimiter is to be interpreted. Valid values are
-- 'ANY' to treat the entire delimiter string as a single occurance
-- of a delimiter which must be matched exactly, or 'ANY' to treat
-- the delimiter string as a set of single character delimiters, any
-- of which is a delimiter. The default is 'ANY'.
-- Return the first item in a list.
FUNCTION head(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (head,WNDS,WNPS);
-- Return the remainder of a list after the first item and its delimiter.
FUNCTION tail(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (tail,WNDS,WNPS);
-- Return the nth item in a list.
-- The parameter, item_num, denotes which item to return.
FUNCTION item(
list_in IN VARCHAR2,
item_num IN INTEGER DEFAULT 1,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (item,WNDS);
-- Append an item to a list and return the new list.
-- The parameter, item_in, contains the new item to append.
FUNCTION append_item(
list_in IN VARCHAR2,
item_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (append_item,WNDS);
-- Return the number of items in a list.
FUNCTION num_items(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER;
PRAGMA RESTRICT_REFERENCES (num_items,WNDS);
-- Search a list for an item, and give its location in the list,
-- or zero IF not found.
-- The parameter, item_in, gives the item to be found in the list.
FUNCTION in_list(
list_in IN VARCHAR2,
item_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER;
PRAGMA RESTRICT_REFERENCES (in_list,WNDS);
-- Convert an array to a delimited list.
-- The array to be input is a DBMS_UTILITY.uncl_array so that
-- the LIST package is compatible with the comma_to_table and
-- table_to_comma built ins.
-- In this function, delimiter is always treated as a single
-- string.
FUNCTION array_to_list(
array_in IN DBMS_UTILITY.UNCL_ARRAY,
arrlen_in IN INTEGER,
delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (array_to_list,WNDS,WNPS);
-- Print a list using DBMS_OUTPUT.
PROCEDURE print_list(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY');
-- Convert a list to an array and return the array and its size.
-- This is a procedure because it returns more than one value.
-- The array to be returned is a DBMS_UTILITY.uncl_array so that
-- the LIST package is compatible with the comma_to_table and
-- table_to_comma built ins.
PROCEDURE list_to_array(
list_in IN VARCHAR2,
arrlen OUT BINARY_INTEGER,
array_out OUT DBMS_UTILITY.uncl_array,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY');
-- Sort a list
-- Null items are always skipped when sorting lists, since they would sort
-- to the end of the list anyway. CMPFNC is the name of a function to compare
-- two items. The default of '>' sorts in ascending order, '<' in descending order.
-- If you write your own function to be used for sorting, it must:
-- 1. Take two parameters of type VARCHAR2
-- 2. Return an INTEGER
-- 3. Return a negative number if the first item is to sort lower than
-- the second, a zero if they are to sort as if equal, or a positive
-- number if the first item is to sort higher than the second.
-- 4. Be executable by the user running the sort. Normal naming rules apply.
FUNCTION sort_list(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
cmpfnc IN VARCHAR2 DEFAULT '>',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2;
PRAGMA RESTRICT_REFERENCES (sort_list,WNDS);
end;
***END PACKAGE SPEC***
***BEGIN BODY***
CREATE OR REPLACE PACKAGE BODY list IS
current_list VARCHAR2(32760) DEFAULT '';
current_delim VARCHAR2(30) DEFAULT ',';
TYPE list_array IS TABLE OF VARCHAR2(2000)
INDEX BY BINARY_INTEGER;
current_array list_array;
current_arrlen BINARY_INTEGER DEFAULT 0;
current_null_item VARCHAR2(4) DEFAULT '';
current_delimiter_use VARCHAR2(3) DEFAULT '';
-- Find the first delimiter.
FUNCTION find_delimiter(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN BINARY_INTEGER IS
delimiter_loc BINARY_INTEGER;
BEGIN
IF upper(delimiter_use) = 'ALL' THEN
delimiter_loc := INSTR(list_in,delimiter);
ELSIF upper(delimiter_use) = 'ANY' THEN
delimiter_loc := INSTR(TRANSLATE(list_in,delimiter,ltrim(RPAD(' ',LENGTH(delimiter)+1,CHR(31)))),CHR(31));
END IF;
RETURN delimiter_loc;
END find_delimiter;
-- Return the first item in a list.
FUNCTION head(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 IS
delimiter_loc BINARY_INTEGER;
BEGIN
delimiter_loc := find_delimiter(list_in,delimiter,null_item,delimiter_use);
IF delimiter_loc > 1 THEN
RETURN SUBSTR(list_in,1,delimiter_loc-1);
ELSIF delimiter_loc = 1 THEN
RETURN NULL;
ELSE
RETURN list_in;
END IF;
END head;
-- Return the remainder of a list after the first item and its delimiter.
FUNCTION tail(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 IS
start_ch BINARY_INTEGER;
BEGIN
start_ch := find_delimiter(list_in,delimiter,null_item,delimiter_use);
IF start_ch = 0 THEN
RETURN NULL;
ELSE
IF upper(delimiter_use) = 'ALL' THEN
start_ch := start_ch + LENGTH(delimiter);
ELSE
start_ch := start_ch + 1;
END IF;
IF start_ch > LENGTH(list_in) THEN
RETURN NULL;
ELSE
RETURN SUBSTR(list_in,start_ch);
END IF;
END IF;
END tail;
-- Convert a list to an array.
PROCEDURE parse_list(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') IS
list_to_parse VARCHAR2(32760);
BEGIN
IF list_in = current_list AND
delimiter = current_delim AND
null_item = current_null_item AND
delimiter_use = current_delimiter_use THEN
NULL;
ELSE
current_list := list_in;
current_delim := delimiter;
current_null_item := upper(null_item);
current_delimiter_use := upper(delimiter_use);
list_to_parse := list_in;
current_arrlen := 0;
WHILE list_to_parse IS NOT NULL LOOP
IF current_null_item <> 'SKIP' OR
head(list_to_parse,delimiter,null_item,delimiter_use) IS NOT NULL THEN
current_arrlen := current_arrlen + 1;
current_array(current_arrlen) := SUBSTR(head(list_to_parse,delimiter,null_item,delimiter_use),1,2000);
END IF;
list_to_parse := tail(list_to_parse, delimiter,null_item,delimiter_use);
END LOOP;
END IF;
END parse_list;
-- Convert a list to an array and return the array and its size.
PROCEDURE list_to_array(
list_in IN VARCHAR2,
arrlen OUT BINARY_INTEGER,
array_out OUT DBMS_UTILITY.uncl_array,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') IS
BEGIN
parse_list(list_in,delimiter,null_item,delimiter_use);
arrlen := current_arrlen;
FOR i IN 1..arrlen LOOP
array_out(i) := SUBSTR(current_array(i),1,240);
END LOOP;
END list_to_array;
-- Print a list using DBMS_OUTPUT.
PROCEDURE print_list(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') IS
BEGIN
DBMS_OUTPUT.ENABLE(100000);
parse_list(list_in,delimiter,null_item,delimiter_use);
FOR i IN 1..current_arrlen LOOP
dbms_output.put_line(SUBSTR(current_array(i),1,240));
END LOOP;
END print_list;
-- Return the number of items in a list.
FUNCTION num_items(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER is
BEGIN
parse_list(list_in,delimiter,null_item,delimiter_use);
RETURN current_arrlen;
END num_items;
-- Return the nth item in a list.
FUNCTION item(
list_in IN VARCHAR2,
item_num IN INTEGER DEFAULT 1,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 is
BEGIN
parse_list(list_in,delimiter,null_item,delimiter_use);
IF item_num NOT BETWEEN 1 AND current_arrlen THEN
RETURN NULL;
ELSE
RETURN current_array(item_num);
END IF;
END item;
-- Append an item to a list and return the new list.
-- The parameter, item_in, contains the new item to append.
FUNCTION append_item(
list_in IN VARCHAR2,
item_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2 IS
BEGIN
IF list_in IS NULL THEN
RETURN item_in;
ELSE
RETURN list_in || delimiter || item_in;
END IF;
END append_item;
-- Search a list for an item, and give its location in the list,
-- or zero IF not found.
FUNCTION in_list(
list_in IN VARCHAR2,
item_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
null_item IN VARCHAR2 DEFAULT 'KEEP',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN INTEGER is
BEGIN
parse_list(list_in,delimiter,null_item,delimiter_use);
FOR item_num IN 1..current_arrlen LOOP
IF current_array(item_num) = item_in THEN
RETURN item_num;
END IF;
END LOOP;
RETURN 0;
END in_list;
-- Convert an array to a delimited list.
FUNCTION array_to_list(
array_in IN DBMS_UTILITY.UNCL_ARRAY,
arrlen_in IN INTEGER,
delimiter IN VARCHAR2 DEFAULT ',') RETURN VARCHAR2 IS
list_out VARCHAR2(32760):= '';
BEGIN
FOR item_num IN 1 .. arrlen_in LOOP
EXIT WHEN LENGTH(list_out) +
LENGTH(array_in(item_num)) > 32760;
list_out := list_out||array_in(item_num);
IF item_num < arrlen_in THEN
list_out := list_out||delimiter;
END IF;
END LOOP;
RETURN list_out;
END array_to_list;
-- Sort a list
FUNCTION sort_list(
list_in IN VARCHAR2,
delimiter IN VARCHAR2 DEFAULT ',',
cmpFnc IN VARCHAR2 DEFAULT '>',
delimiter_use IN VARCHAR2 DEFAULT 'ANY') RETURN VARCHAR2 IS
temp_array list_array;
temp_len PLS_INTEGER := 0;
temp_item VARCHAR2(2000);
list_out VARCHAR2(32760);
PROCEDURE swap (
first_item IN OUT VARCHAR2,
second_item IN OUT VARCHAR2) IS
temp_item VARCHAR2(2000);
BEGIN
temp_item := first_item;
first_item := second_item;
second_item := temp_item;
END swap;
FUNCTION cmp (
first_item IN VARCHAR2,
second_item IN VARCHAR2,
cmpfnc IN VARCHAR2 DEFAULT '=') RETURN INTEGER IS
return_value INTEGER;
BEGIN
IF cmpfnc = '>' THEN
IF first_item < second_item THEN
return_value := -1;
ELSIF first_item = second_item THEN
return_value := 0;
ELSIF first_item > second_item THEN
return_value := 1;
END IF;
ELSIF cmpfnc = '<' THEN
IF first_item > second_item THEN
return_value := -1;
ELSIF first_item = second_item THEN
return_value := 0;
ELSIF first_item < second_item THEN
return_value := 1;
END IF;
ELSE
EXECUTE IMMEDIATE 'BEGIN :I := '||cmpfnc||'(:A,:B); END;'
USING OUT return_value, IN first_item, IN second_item;
END IF;
RETURN return_value;
END cmp;
BEGIN
parse_list(list_in,delimiter,'SKIP',delimiter_use);
FOR item_num IN 1..current_arrlen LOOP
temp_item := current_array(item_num);
FOR i IN 1..temp_len LOOP
IF cmp(temp_array(i),temp_item,cmpfnc) > 0 THEN
swap(temp_array(i),temp_item);
END IF;
END LOOP;
temp_len := temp_len + 1;
temp_array(temp_len) := temp_item;
END LOOP;
FOR item_num IN 1..temp_len LOOP
EXIT WHEN LENGTH(list_out) +
LENGTH(temp_array(item_num)) > 32760;
list_out := list_out||temp_array(item_num);
IF item_num < temp_len THEN
list_out := list_out||delimiter;
END IF;
END LOOP;
RETURN list_out;
END sort_list;
END;
*** END BODY***
Carl -
How to query XML data stored in a CLOB column
I don't know XMLDB, so I have a dumb question about querying XML data which is saved as CLOB in a table.
I have a table (OLAP_AW_PRC), with a CLOB column - AW_XML_TMPL_VAL
This column contains this xml data - [click here|http://www.nasar.net/aw.xml]
Now I want to query the data using the xml tags - like returning the name of AW. This is where I am having trouble, how to query the data from AW_XML_TMPL_VAL clob column.
The following query generates error:
ORA-31011: XML parsing failed.
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
SELECT
extractValue(value(x), '/AW/LongName') as "AWNAME"
from
OLAP_AW_PRC,
table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
where
extractValue(value(x) , '/AW/Name') = 'OMCR4'
- NasarMark,
Thanks. This is exactly what I was looking for.
After doing @Name in both places (SELECT and WHERE clause) it worked.
Now I have one more question.
There are multiple DIMENSION tags in my xml, and I want to see the NAME attribute values for all of those DIMENSIONs. The following query returns
ORA-19025: EXTRACTVALUE returns value of only one node.
Cause: Given XPath points to more than one node.
Action: Rewrite the query so that exactly one node is returned.
SELECT
extractValue(value(x), '/AW/@Name') as "AW",
extractValue(value(x), '/AW/Dimension/@Name') as "DIMENSIONS"
from
OLAP_AW_PRC,
table(xmlsequence(extract (xmltype(AW_XML_TMPL_VAL), '/AWXML/AWXML.content/Create/ActiveObject/AW'))) x
where
extractValue(value(x) , '/AW/@Name') = 'OMCR4' -
How to get save result from EXECUTE from a dynamic SQL query in another table?
Hi everyone,
I have this query:
declare @query varchar(max) = ''
declare @par varchar(10)
SELECT @par = col1 FROM Set
declare @region varchar(50)
SELECT @region = Region FROM Customer
declare @key int
SELECT @key = CustomerKey FROM Customer
SET @query = 'SELECT CustomerKey FROM Customer where ' + @par + ' = '+ @key+ ' '
EXECUTE (@query)
With this query I want get col1 from SET and compare it to the column Region from Customer. I would like to get the matching CustomerKey for it.
After execution it says commands are executed successfully. But I want to save the result from @query in another table. I looked it up and most people say to use sp_executesql. I tried a few constructions as sampled and I would always get this error:
Msg 214, Level 16, State 2, Procedure sp_executesql, Line 12
Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.
So the output should be a list of CustomerKeys in another table.
How can I save the results from EXECUTE into a variable? Then I assume I can INSERT INTO - SELECT in another table.
ThanksCREATE TABLE Customer
(CustomerKey INT , Name NVARCHAR(100));
GO
INSERT dbo.Customer
VALUES ( 1, N'Sam' )
GO
DECLARE @query nvarchar(max) = ''
declare @par varchar(10) = 'Name',
@key varchar(10) = 'Sam'
CREATE TABLE #temp ( CustomerKey INT );
SET @query =
insert #temp
SELECT CustomerKey
FROM Customer
where ' + @par + ' = '''+ @key+ ''' '
PRINT @query
EXEC sp_executesql @query
SELECT *
FROM #temp
DROP TABLE #temp;
DROP TABLE dbo.Customer
Cheers,
Saeid Hasani
Database Consultant
Please feel free to contact me at [email protected] as well as on Twitter and Facebook.
[My Writings on TechNet Wiki] [T-SQL Blog] [Curah!]
[Twitter] [Facebook] [Email] -
How to generate XML file from oracle database query result
Hi dudes,
as stated on the subject, can anyone suggests me how can i achieve the task stated above??
Here is a brief description of my problem:
I need to create a XML file once i query from the oracle database, and the query result returned from the database will be stored in XML file.
I'd searched around the JAXB, DOM, SAXP and the like basic concepts, but i still don't know how to start??
Any suggestions ???Read this:
http://www.cafeconleche.org/books/xmljava/chapters/ch08s05.html
You might have to read more of the book to understand that chapter. -
Challenge: How to create an BMP Java Bean from a DBF Database??
Hello guys....
This is my challenge and looking for some aim:
I was asked to create an application that must read from an existing DBF Database of products (That is already used by an administrative system) an build a Price List in Real Time. The program must be accesible through Intranet using a web browser.
The Appplication Client must be a faster GUI (Applet or App) that do not cause interference in the normal functions of the Administrative System that owns the DBF Database, but must propagate any change maded to the database in real time.
I was thinking to use BMP Entity Beans for manage the DBF Tables and Utility Beans to avoid constan access to the tables (As in Duke�s Bank Tutorial) but i do not know how to create a BMP Entity Bean without a Database that do not have an JDBC Driver ?????????
i was able to gain access to DBF TAbles using an small library called TinySQl but i get lost in this point....
any suggestions/comments about following matters will be apreciate:
1.- Application Performance Tips
2.- A better JDBC Driver for DBF Databases
3.- Application�s Security
4.- User Management
5.- Any comments in general !!!!!!!!!!
Initially 15 Duke�s Dollar will be offered to the best anwser, but i considering to offer 5 duke�s dollar to the best second anwser that can be earned through another post i will create later!!!!!!!!!11
Regards.................Hello guys....
This is my challenge and looking for some aim:
I was asked to create an application that must read
from an existing DBF Database of products (That is
already used by an administrative system) an build a
Price List in Real Time. The program must be
accesible through Intranet using a web browser.
The Appplication Client must be a faster GUI (Applet
or App) that do not cause interference in the normal
functions of the Administrative System that owns the
DBF Database, but must propagate any change maded to
the database in real time.
I was thinking to use BMP Entity Beans for manage the
DBF Tables and Utility Beans to avoid constan access
to the tables (As in Duke�s Bank Tutorial) but i do
not know how to create a BMP Entity Bean without a
Database that do not have an JDBC Driver ?????????
i was able to gain access to DBF TAbles using an
small library called TinySQl but i get lost in this
point....
any suggestions/comments about following matters will
be apreciate:
1.- Application Performance Tips
2.- A better JDBC Driver for DBF Databases
3.- Application�s Security
4.- User Management
5.- Any comments in general !!!!!!!!!!
Initially 15 Duke�s Dollar will be offered to the
best anwser, but i considering to offer 5 duke�s
dollar to the best second anwser that can be earned
through another post i will create later!!!!!!!!!11
Regards.................
PLEASE DO NOT POST REPLIES IN THIS THREAD, USE THE UPPER THREAD THAT HAVE 10 DUKE�S DOLLARS ASSIGNED.
SORRY -
WCF Service and Sharepoint Form library : How i can read or access a form libray and query a item from file name and read form xml in WCF service ?
Ahsan RanjhaHi,
In SharePoint 2013, we can take use of REST API or Client Object Model to access the SharePoint objects like Form Library.
SharePoint 2013 REST API
http://msdn.microsoft.com/en-us/library/office/dn450841(v=office.15).aspx
http://blogs.technet.com/b/fromthefield/archive/2013/09/05/working-with-sharepoint-list-data-odata-rest-and-javascript.aspx
SharePoint 2013 Client Object Model
http://msdn.microsoft.com/en-us/library/office/fp179912(v=office.15).aspx
http://msdn.microsoft.com/en-us/library/office/jj193041(v=office.15).aspx
With the retrieved file, we can then use XmlDocument object to parse it and get the values you want:
http://weblogs.asp.net/jimjackson/opening-and-reading-an-xml-file-in-a-document-library
http://stackoverflow.com/questions/1968809/programatically-edit-infopath-form-fields
Best regards
Patrick Liang
TechNet Community Support -
How can i lookup a session bean from the client side
how can i lookup a session bean from the client side...........i am using sun appserver..............
this is my code.................[B]
private final static String JNDI_NAME="ejb/LmsBean";
private static String url="ldap://localhost:4848";
Hashtable h=new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");
h.put(Context.PROVIDER_URL,url);
System.out.println("Before Loading Context in Delegate");
Context ctx=new InitialContext(h);
System.out.println("Loaded Context in Delegate");
Object obj=ctx.lookup(JNDI_NAME);
System.out.println("Loaded Object in Delegate");
System.out.println("Before Loading Home in Delegate");
LmsHome home = (LmsHome )PortableRemoteObject.narrow(obj,com.parx.lms.controller.LmsHome.class);
System.out.println("Loaded Home in Delegate");
lms = home.create();
System.out.println("Loaded remote in Delegate");
[B]and i got the exception........
Inside Client before calling delegate
Before Loading Context in Delegate
javax.naming.CommunicationException: Request: 1 cancelled
javax.naming.CommunicationException: Request: 1 cancelled
at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60)
at com.sun.jndi.ldap.Connection.readReply(Connection.java:405)
at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:340)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:171)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2640)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:290)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193
at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.ja
va:136)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.jav
a:66)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
62)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at com.parx.lms.lmsdelegate.LmsDelegate.getController(LmsDelegate.java:3
0)
at com.parx.lms.lmsdelegate.LmsDelegate.addUserDelegate(LmsDelegate.java
:50)
at com.parx.lms.client.consoleClient.Client.main(Unknown Source)
pls go tru the exception and pls help.........That url string should be having the server name or ip instead of localhost.
Maybe you are looking for
-
Playing a sound file more than once in a row?
OK, so I got the PlayWavFile code from the Internet, and I've modified it a bit so that it has a play method, but I'm trying to get it to play 5 times in a row. The thing is, I can't seem to get a for loop to work around it. Also, since I've never me
-
Can't find time characteristics
Hi, I have a MultiProvider which is on 2 ODSes. I can't find any time characteristics in the MultiProvider. And when I am building a query I can't find the time dimension either. Please suggest. Thanks SAPBW
-
If a business kept 3 agent who is collected payment for 3000 customer then how we can check the report for each agent wise that how much outstanding collected & how much peneding for that 3000 customer.Please give me the solution. Thanks, Miku.
-
Hey, I'm probably going to buy a mac mini very soon (Either the PPC 1.25GHZ 512 Ram, PPC 1.42GHZ 512 Ram or Intel Core Solo 1.5GHZ). I'm not a heavy gamer but I enjoy World of Warcraft, Warcraft III and some shooters like Half Life. I don't care abou
-
Re: My TEAC DV-w28ECT driver used to read both DVD and CD now it only reads DVD
My TEAC DV-w28ECT driver used to read both DVD and CD now, it only reads DVDs. what happened and how can I fix it? I have Windows Vista