Getting a Clob Value from an OUT Parameter
I am having trouble fetching the CLOB Value(an XML Document) from an Out parameter. I have been
trying to fetch the value into a String, an OracleClob, etc.. no luck still get either an invalid
cast or a DBNULL value. Is there an example out there for returning and manipulating CLOBS in either VB.NET or in C#.
Thanks,
Scott E. Hunley
Scott,
Hopefully, this will help:
========================== C# code begin ===========================
using System;
using System.Data;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
namespace Test
class OutClob
static OracleCommand cmd;
static void Execute(string sql)
try
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
catch (Exception e)
Console.WriteLine(e.Message);
static void Main(string[] args)
// connect
OracleConnection con = new OracleConnection();
con.ConnectionString = "user id=scott;password=tiger;data source=ora92;";
con.Open();
// instantiate the command object
cmd = new OracleCommand();
cmd.Connection = con;
// drop table
Execute("drop table foo");
// create table
Execute("create table foo (num number, xml clob)");
// insert a row with xml data in a CLOB column
Execute("insert into foo values (1, '<foo>bar</foo>')");
// bind and output parameter for an anonymous PL/SQL block
OracleParameter p1 = cmd.Parameters.Add("p1", OracleDbType.Clob);
p1.Direction = ParameterDirection.Output;
// execute the anonymous PL/SQL block which returns a CLOB as an
// output parameter of type OracleClob
Execute("begin select xml into :1 from foo where num = 1; end;");
// Obtain the clob with the proper cast
OracleClob clob = (OracleClob)p1.Value;
// print out the XML document
Console.WriteLine(clob.Value);
========================== C# code end ===========================
Output:
<foo>bar</foo>
Similar Messages
-
Get all the values from a multiple select in a multipart form
Hi there!
I am using a form with enctype="multipart/form-data" in order to upload files from the form.
I have read this page: http://commons.apache.org/fileupload/using.html and everything works well for my form.
The only problem is that I can't get all the values from a "multiple select" html object. I get only one value.
Using servlets I have used this method:
public java.lang.String[] getParameterValues(java.lang.String name) But now I have enctype="multipart/form-data" in my form and I can't use this way...
Is there a way to get all the values of a multi-valued parameter?
Thanks a lot!
StefanoHi
I have got solution for this problem so, I am listing here logic
assume tag name of html
<select name="moption" multiple="multiple">
iterate it in as
String moption="";
boolean cnt=true;
while(itr.hasNext())
FileItem fi=(FileItem)itr.next();
if(fi.isFormField())
if(fi.getFieldName().equals("moption"))
if(cnt==true)
moption=fi.getString();
cnt=false;
else
moption=moption+","+fi.getString();
If wants more help then mail me your problem
at [email protected]
Thanks!
Anand Shankar
Edited by: AnandShankar on 6 Nov, 2009 12:54 PM -
How to get edited row values from ADF table?
JDev 11.
I have a table which is populated with data from Bean.
I need to save changes after user make changes in any table cell. InputText is defined for table column component.
I have defined ValueChangeListener for inputText field and AutoSubmit=true. So when user change value in inputText field, method is called:
public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
getSelectedRow();
SaveMaterial(material);
This method should call getSelectedRow which take values from selected table row and save them into object:
private Row getSelectedRow(){
RichTable table = this.getMaterialTable();
Iterator selection = table.getSelectedRowKeys().iterator();
while (selection.hasNext())
Object key = selection.next();
table.setRowKey(key);
Object o = table.getRowData();
material = (MATERIAL) o;
System.out.println("Selected Material Desc = "+material.getEnumb());
return null;
Problem is that getSelectedRow method doesnt get new (edited) values, old values are still used.
I have tried to use ActiveButton with same method and it works fine in that case. New values are selected from active row and inserted into object.
JSF:
<af:table var="row" rowSelection="single" columnSelection="single"
value="#{ManageWO.material}" binding="#{ManageWO.materialTable}">
<af:column sortable="false" headerText="E-number">
<af:inputText value="#{row.enumb}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
</af:column>
<af:column sortable="false" headerText="Description">
<af:inputText value="#{row.desc}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
</af:column>
</af:table>
<af:activeCommandToolbarButton text="Save" action="#{ManageWO.EditData}"/>
What is a correct place from where save method should be called to get new (edited) values from ADF table?
Thanks.Did you look into the valueChangeEvent?
It has oldValue and newValue attributes.
public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
Object oldVal = valueChangeEvent.getOldValue();
Object newVal = valueChangeEvent.getNewValue();
// check if you see what you are looking for.....
getSelectedRow();
SaveMaterial(material);
}Timo -
Getting all the values from a JList
Hi,
I want to get all the values from a JList and store it into an array. Any method is available to perform this task? Pls help me out with this task.Use getModel() on the list to get the ListModel and then call getSize() and getElementAt(int) to loop over the elements
HTH
Mike -
How Can I get multi column values from dynamic search help?
Hi Gurus;
I'm using dynamic search help in my program.
I want to get multi column values from search help. But I dont know solution for this issue.
I'm using F4IF_INT_TABLE_VALUE_REQUEST FM.
How Can I get multi column values from dynamic search help?
Thanks.Believe it or not, the same FM worked for me in a dynpro. I will try to explain here how it works in custom screen and then you can do your work for other screens or program types. I am not going to write my actual work but will explain in general.
I have 4 fields (FLD1, FLD2, FLD3, FLD4) and i made the search based on FLD2 and when user click on a line (could be any field), then this would bring the line on to the screens.
There are like 3 steps.
You have your value_tab for my fields FLD1, FLD2, FLD3 and FLD4. This is just the data that we pass into the FM. (data: IT_VALTAB type table of ZVAL_TABLE)
Next map the screen fields into an internal table (data: It_dynpfld type table of dselc ). I also have other internal tables defined (just to keep it straight, i will be putting here) data: It_return type standard table of ddshretval.
Next step is to call the function module. Make sure you have values in IT_VALTAB.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'FLD2'
value_org = 'S'
tables
value_tab = It_VALTAB
return_tab = It_return
dynpfld_mapping = It_dynpfld
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
perform get_selected_fields tables It_return.
endif.
The code within the perform GET_SELECTED_FIELDS - We need to map the result fields after user selects it. The code goes like this. This is step is to update the dynpro fields.
I need a internal table as well as a work area here. like,
data: lt_fields type table of dynpread,
la_fields type dynpread.
field-symbols: <fs_return> type ddshretval.
so fill out LT_FIELDS from the IT_RETURN table
loop at lt_return assigning <fs_return>.
la_fields-fieldname = <fs_return>-retfield.
la_fields-fieldvalue = <fs_return>-fieldval.
append la_fields to lt_fields.
clear: la_fields.
endloop.
Call the FM to update the dynpro
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = sy-repid
dynumb = '1002' "This is my screen number. You could use 1000 for selection screen (hope so)
tables
dynpfields = lt_fields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
good luck -
How to get the Node Value from XmlValue result?
Hi ,
I am not able to get the Node Value from the result. In my XQuery im selecting till a Node, if i change my query as
collection('PhoneBook')/phone_book/contact_person/address/string()", qc);
im getting the node value, but here the problem is its not a Node so i cannot get the Node name.
So how can i get the Node Name and Node value together?
any help please ????
XML :
<?xml version="1.0" encoding="UTF-8"?>
<phone_book>
<contact_person>
<name>
<first_name>Michael</first_name>
<second_name>Harrison</second_name>
</name>
<address city="yyyyy" pincode="600017" state="xxxxx">
176 Ganesan street, Janakinagar, alwarthirunagar
</address>
</contact_person>
<phone_number type="mobile">9881952233</phone_number>
<phone_number type="home">044-24861311</phone_number>
<phone_number type="office">080-12651174</phone_number>
</phone_book>
Code:
XmlQueryContext qc = manager.createQueryContext();
XmlResults rs = manager.query
("collection('PhoneBook')/phone_book/contact_person/address", qc);
while(rs.hasNext()){
XmlValue val = rs.next();
System.out.println(val.getNodeName() + " = [ " + val.getNodeValue() + " ] ");
Output
address = [ ]You are right, this seemed un-intuitive to me too, but I finally understood how it's done.
The "value" of a node is actually the total amount of text that is not contained in any of the node's child nodes (if any). So a node with child nodes can still have text value.
To get the 'value' of an element node, you must therefore concatenate the values of all children of type "XmlValue::TEXT_NODE", of that node. Try it.
In your example, the <address> node has no child elements, my guess is that BDB XML stores the address string "176 Ganesan street, Janakinagar, alwarthirunagar" inside a child node of <address> node (of type XmlValue::TEXT_NODE) because you wrote the string on a separate line. -
How can i get the all values from the Property file to Hashtable?
how can i get the all values from the Property file to Hashtable?
ok,consider my property file name is pro.PROPERTIES
and it contain
8326=sun developer
4306=sun java developer
3943=java developer
how can i get the all keys & values from the pro.PROPERTIES to hashtable
plz help guys..............The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
InputStream is = new FileInputStream("tivoli.properties");
props.load(is); -
How to get all the values from the dropdown menu
How to get all the values from the dropdown menu
I need to be able to extract all values from the dropdown menu; I know how to get all those values as a string, but I need to be able to access each item; (the value in a dropdown menu will change dynamically)
How do I get number of item is selection dropdown?
How do I extract a ?name? for each value, one by one?
How do I change a selection by referring to particular index of the item in a dropdown menu?
Here is the Path to dropdown menu that I'm trying to access (form contains number of similar dropdowns)
RSWApp.om.GetElementByPath "window(index=0).form(id=""aspnetForm"" | action=""advancedsearch.aspx"" | index=0).formelement[SELECT](name=""ctl00$MainContent$hardwareBrand"" | id=""ctl00_MainContent_hardwareBrand"" | index=16)", element
Message was edited by: testtestThe findElement method allows various attributes to be used to search. Take the following two examples for the element below:
<Select Name=ProdType ID=testProd>
</Select>
I can find the element based on its name or any other attribute, I just need to specify what I am looking for. To find it by name I would do the following:
Set x = RSWApp.om.FindElement("ProdType","SELECT","Name")
If I want to search by id I could do the following:
Set x = RSWApp.om.FindElement("testProd","SELECT","ID")
Usually you will use whatever is available. Since the select element has no name or ID on the Empirix home page, I used the onChange attribute. You can use any attribute as long as you specify which one you are using (last argument in these examples)
You can use the FindElement to grab links, text boxes, etc.
The next example grabs from a link on a page
Home
Set x = RSWApp.om.FindElement("Home","A","innerText")
I hope this helps clear it up. -
How to get the return values from a web page
Hi all :
how to get the return values from a web page ? I mean how pass values betwen webflow and web page ?
thank you very much
Edited by: jingying Sony on Apr 15, 2010 6:15 AM
Edited by: jingying Sony on Apr 15, 2010 6:18 AMHi,
What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
Regards,
Karri -
Is it possible to assign a default value to an out parameter??
Is it possible to assign a default value to an out parameter??
Thanks in advance.pradeep.vupala wrote:
I think ur looking for an IN OUT parameter?That won't help.
A quick test is easy to check what happens :
SQL> create or replace procedure myproc(p_out out number default 1)
2 as
3 begin
4 null;
5 end;
6 /
Warning: Procedure created with compilation errors.
SQL> show err
Errors for PROCEDURE MYPROC:
LINE/COL ERROR
1/18 PLS-00230: OUT and IN OUT formal parameters may not have default expressions
SQL> create or replace procedure myproc(p_out in out number default 1)
2 as
3 begin
4 null;
5 end;
6 /
Warning: Procedure created with compilation errors.
SQL> show err
Errors for PROCEDURE MYPROC:
LINE/COL ERROR
1/18 PLS-00230: OUT and IN OUT formal parameters may not have default expressions
SQL> -
Bonjour,
Suite au passage à la version CVI 2013, il faut passer par un fichier .obj au lieu du .c quand on veut utiiser la LoadExternalModule.
Le pb qui en résulte impossibilité de récupérer la valeur des control dans l'uir géré par le .obj qui est appelé par une dll.
Autrement, il m'est impossible de faire parvenir à la dll les valeur des control ( dll qui appelle le .obj).
Quelqu'un a eu le même soucis amigos?
Merci
Hi,
When using the LoadExternalModule function in CVI 2013, we can no longer use a .c file. Instead we have to use an .obj file.
My issue is that' impossible for me to get a control value from an .iur managed by the .obj witchi is called by a dll.
Otherwise it's impossible for me to get the control vale when calling the .obj from a dll.
Any suggestions Amigos
ThanksFor people who could be interested in, here the code I provided to the customer. This code demonstrates that calling a function defined in a .obj file from a DLL which is called itself by a program can be realized without throwing any error.
In order to use this example, you will have to :
1) Open "main.cws"
2) Define "Madll" as Active Project (right clic on the project and click on "Set Active Project")
3) Build the DLL (CTRL+M)
4) Define "Main" as Active Project
5) Click on "Debug Project" in order to build the executable and run it
This example has been built with CVI 2013.
Jérémy C.
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
Travaux Pratiques d'initiation à LabVIEW et à la mesure
Du 2 au 23 octobre, partout en France
Attachments:
main.zip 70 KB -
Show selected value from multi-selected parameter in crystal report
Dear Experts!
i would like to ask how to catch selected value from multi-selected parameter to show in report header section.
Thanks in advance.Hi Dara,
If this is a string prompt then you could simply create a formula with this code and place it on the report header:
Join({?Prompt name},", ")
-Abhilash -
Getting 2nd Least Value from Different Column
Hi there All,
I have one odd requirement.
I hava table which has diffrent columns of numeric Datatype.
The task is to get the least values from the table.
I can take the least value by least(col1,col2,col3 ...) function.Until this stage it is fine.
But also I have take 2nd least value and 3rd least value, which I am quite unsure how to get it.
Looking forward for suggestions.
Thanks in Advance.
Regards,
AjeetThe following is a generic solution that will allow you to select the nth least and allow you to pass as many column names as you like and will return null if the nth least requested exceeds the number of distinct values. The nleast function that I wrote uses the str2tbl function by Tom Kyte. I have included a demonstration of its usage below. The value returned for the 1st least is the same as that returned by the least function.
This should have been posted on the SQL and PL/SQL discussion group of these forums, rather than the general database. I also posted the same response in the SQL discussion group of the Orafaq forums.
scott@ORA92> -- test data:
scott@ORA92> SELECT * FROM your_table
2 /
COL1 COL2 COL3
1 2 3
4 6 5
8 7 9
11 12 10
15 13 14
18 17 16
6 rows selected.
scott@ORA92> -- type and functions:
scott@ORA92> create or replace type myTableType as table of number;
2 /
Type created.
scott@ORA92> create or replace function str2tbl( p_str in varchar2 )
2 return myTableType
3 as
4 l_str long default p_str || ',';
5 l_n number;
6 l_data myTableType := myTabletype();
7 begin
8 loop
9 l_n := instr( l_str, ',' );
10 exit when (nvl(l_n,0) = 0);
11 l_data.extend;
12 l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
13 l_str := substr( l_str, l_n+1 );
14 end loop;
15 return l_data;
16 end;
17 /
Function created.
scott@ORA92> CREATE OR REPLACE FUNCTION nleast
2 (p_n IN NUMBER,
3 p_nums IN VARCHAR2)
4 RETURN NUMBER
5 AS
6 v_nleast NUMBER;
7 BEGIN
8 SELECT DISTINCT column_value
9 INTO v_nleast
10 FROM (SELECT column_value,
11 DENSE_RANK () OVER (ORDER BY column_value) AS num_rk
12 FROM (select *
13 from table (CAST (str2tbl (p_nums) AS mytabletype)))
14 WHERE column_value IS NOT NULL)
15 WHERE num_rk = p_n;
16 RETURN v_nleast;
17 EXCEPTION
18 WHEN OTHERS THEN RETURN NULL;
19 END nleast;
20 /
Function created.
scott@ORA92> SHOW ERRORS
No errors.
scott@ORA92> -- query:
scott@ORA92> SELECT col1, col2, col3,
2 LEAST (col1, col2, col3) AS the_least,
3 nleast (1, col1 || ',' || col2 || ',' || col3) AS first_least,
4 nleast (2, col1 || ',' || col2 || ',' || col3) AS second_least,
5 nleast (3, col1 || ',' || col2 || ',' || col3) AS third_least,
6 nleast (4, col1 || ',' || col2 || ',' || col3) AS fourth_least
7 FROM your_table
8 /
COL1 COL2 COL3 THE_LEAST FIRST_LEAST SECOND_LEAST THIRD_LEAST FOURTH_LEAST
1 2 3 1 1 2 3
4 6 5 4 4 5 6
8 7 9 7 7 8 9
11 12 10 10 10 11 12
15 13 14 13 13 14 15
18 17 16 16 16 17 18
6 rows selected. -
About SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WHERE PARAMETER =""
I am developing a web application based on Oacle 10g .But after the DBServe was startedup for about 5~6 hours, the max connection process exceeded. From the DB Administration Tool it shows that there were many INACTIVE Connections which executed
SELECT VALUE FROM NLS_INSTANCE_PARAMETERS WHERE PARAMETER ='NLS_DATE_FORMAT'
But it seems that this is called by the JDBC driver, not my application. How to avoid this, or release the inactive connection?
By the way,who and when call that sql?
Thanks a lot.By the way,who and when call that sql?Also for this you can take an 10046 level 8 sql trace and format the output with sys=yes option of tkprof - http://tonguc.wordpress.com/2006/12/30/introduction-to-oracle-trace-utulity-and-understanding-the-fundamental-performance-equation/
Since we are talking about a web application you may use a database logon trigger to start sql trace for your application user, or if possible you may set sql_trace database parameter to true at instance level for a while and since you are at 10g you can use new package dbms_monitor and trcsess utility - http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sqltrace.htm#sthref2001
Best regards. -
How to get updated table values from objectlistdataproviders
how to get updated table values from objectlistdataproviders
Hi,
Here is a sample code
start-of-selection.
*Select the data you need into an internal table
loop at it_mara into wa_mara.
data that needs to be displayed in the output list
write:/ box as checkbox,
wa_mara-matnr under text-001,
wa_mara-maktx under text-002,
wa_mara-lgort under text-003.
Hide the data that needs to moved to internal table
hide:wa_mara-matnr, wa_mara-maktx, wa_mara-lgort.
endloop.
clear wa_mara.
end-of-selection.
lines = sy-linno.
at line-selection.
clear:it_matnr.
do lines times.
check sy-index > 1.
box = space.
read line sy-index field value box.
if box = 'X'.
*data selected using check box is moved to internal table
append wa_mara to it_matnr.
endif.
enddo.
Regards,
Jisha.
Maybe you are looking for
-
Acrobat does not render text of manually created minimal PDF
I have made a minimal PDF, but the text string is not rendered when opened in Acrobat. (PDF code, without newlines, here: %PDF-1.1 1 0 obj <</Type /Catalog /Pages 2 0 R>> endobj 2 0 obj <</Type /Pages /Kids [3 0 R] /Count 1 /MediaBox [0 0 300 100]>>
-
Has Apple killed the original Apple TV?
We have three original Apple TVs, and one Apple TV 2. All used to be fine but in the last 6 months or so the old ones have become increasingly useless... Every time I try to use one of them, the "connected" computer is greyed out and therefore inacce
-
After you use one of the plug in synths, insted of freezeing it, is there a way to bounce it to a audio track.
-
I am a new user to Mac and I am trying to build a shared library using gcc. However, I am getting errors when creating a execuatble. My system info. is: [email protected] <810> gcc --version i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, I
-
Internet explorer is blocking firefox from downloading
I was able to do the download but immediately got a message from internet explorer that it blocked my download. I click on run but nothing happens so can't get past that point. I am having so much trouble with IE that I have got to get with firefox.