How to returning rowid from a dynamic
which gentleman can do me a favor, tell me how to get the rowid from a returning clause in a dynamic sql.
i use one clause as:
declare
v_rowid char(18);
begin
sql :='insert into test values('a') returning rowid into :rowid';
execute immediate sql using out v_rowid;
dbms_output.put_line(v_rowid);
end;
however, this clause always promte on
value error
i do not know what mistake i made.
declare
v_rowid char(18);
v_sql varchar2(200);
begin
v_sql :='insert into test_Tab values(''a'') returning rowid into :1';
execute immediate v_sql using out v_rowid;
dbms_output.put_line(v_rowid);
end;
Not everyone on this board is a gentleman, some of us are ladies.
null
Similar Messages
-
How to filter results from 4 dynamic list menus depandant on how many of them are selected
I have a search page with a form with 4 list menus and 1 submit that post the results to the results page. I can create a record set that either retrieves the correct data from my database if a selection is made from all four menus Or i can create the recordset if only 3 menus have a selection or the same for 2 menus and 1 menu. However i want the user to be able to make a selection from either 1, 2, 3 or all 4 of the menus and the exact data be retrieved. At present if i try to combine the recordset using AND and ORs the results are not specific enough, for example the 4 menus are Location, Type, Price & Style if a user selects from all 4 i only want to retrieve data that matches all 4 criteria, but at the same time if the user selects only 2 of the menus the i want it to retrieve data that matches specifically those 2 variables. I´m not actually sure if i should be creating a more advanced sql query of if its the php side of things that i need to look at. This is my first dynamic site so please be aware i´m still a learner where php and sql is concerned. Please can anyone help?
Hey there,
Thanks for replying,
I too am using Dreamweaver recordset, my local server is XAMPP ( apache php mysql), i´have pasted my sql recordset below to give an idea of what i´m trying to do, however this does not work as i´m trying to select the exact data based on 4 menus PRICE TYPE LOCATION and BEDS, and also want the search to work if the user only selects options from either 1, 2, 3 or 4 of the menus, with the code as it is if the user select only two options from 2 of the menus the results don´t just find (for example) all results for location AND price they find all results for the location varibale OR the price variable rather than a match for both, if you see what i mean?
Any suggestions?
SELECT trueprice,`desc`, `propid`, `bathrooms`, `photo1`, locationtable.loc, typetable.style, bedtable.`number`
FROM detailstable JOIN locationtable ON detailstable.location=locationtable.locid JOIN typetable ON detailstable.type=typetable.typeid JOIN pricetable ON detailstable.price=pricetable.priceid JOIN bedtable ON detailstable.beds=bedtable.bedid
WHERE (location=varloc AND price = varprice AND type=vartype AND beds=varbed ) OR (price=varprice AND location=varloc AND type=vartype) OR (price=varprice AND location=varloc AND beds=varbed) OR (price=varprice AND beds=varbed AND type=vartype) OR ( location=varloc AND type=vartype AND beds=varbed) OR (price=varprice AND location=varloc) OR (price=varprice AND type=vartype) OR (price=varprice AND beds=varbed) OR (type=vartype AND location=varloc) OR (type=vartype AND beds=beds) OR (location=varloc AND beds=varbed) OR (price = varprice OR beds=varbed OR type=vartype OR location=varloc)
ORDER BY detailstable.trueprice ASC
Look forward to receiving your thoughts,
Linda
Date: Wed, 21 Oct 2009 14:36:33 -0600
From: [email protected]
To: [email protected]
Subject: how to filter results from 4 dynamic list menus depandant on how many of them are selected
Hiya,
I'm just doing my first dynamic site too, and am at a similar level to yourself.
Can you give us more info re the site. What software, eg Dreamweaver etc are you using, and is your server using PHP or ASP etc?
For what I've used, I amended the SQL side of things in the recordset in Dreamweaver. That way, you can test the SQL as you're setting up the recordset.
Let me know how you're going on anyway
Cheers
Andy
> -
How to transfer data from a dynamic internal table
Hi All
I want to transfer data from a dynamic internal table<dyn_table>
to a non dynamic internal table itab which should have the same structure as <dyn_table>.
How can this be done?
Regards,
Harshit RungtaAs stated earlier this can be done only through field symbols...
You cannot create an non dynamic internal table with ANY structure...using DATA statement
If the strucutre is defined well and good...you can create an non-dynamic internal table...
If you do not know the structure then the internal table has to be dynamic...and to be generated using field symbols
DATA: lv_ref TYPE REF TO data.
FIELD-SYMBOLS: <fs_dyn_table> TYPE STANDARD TABLE.
* You create a dynamic internal table...
CREATE DATA lv_ref LIKE (your_dynamic_internal_table).
ASSIGN lv_ref->* TO <fs_dyn_table>.
Now...do the transfer.
<fs_dyn_table> = "your_dynamic_internal_Table
Hope it helps! -
How to return rows from tmp table created inside function??
Hi,
I'm trying to return rows from a cursor or table (created within
the function). How do I specify the return type?Hi,
Here is the code that examples to create a function that can
return data from table.This is achieved using REFCURSOR concept.
Hope this helps you.I'm giving all stuff in single PL/SQL
block.You can break it and create a package and declare
refcursor type and function in that as well.
DECLARE
-- Declare generic cursor type
TYPE gencur_type IS REF CURSOR ;
-- Declare generic cursor varaible
gencur gencur_type;
-- Declare record type
TYPE rec_type IS RECORD(descr emp.ename%type) ;
-- Declare record type variable
rec rec_type;
--This how you declare a local function that returns gencrtype
data set
--This function is called in main block
FUNCTION call_refcur return gencur_type
AS
rr gencur_type;
BEGIN
OPEN rr FOR SELECT descr FROM emp;
RETURN rr;
END;-- end of local function
-- Main block begins here
BEGIN
-- Call the local function so that gencur will have
-- the data set returned by select statement
gencur:= call_refcur;
-- Open a loop to test the stuff
LOOP
FETCH gencur INTO rec;
EXIT WHEN gencur%NOTFOUND;
null;
dbms_output.put_line(rec.ename);
END LOOP;
END;
Regards,
Sridhar -
Oracle forms 9i - How to return back from a block?
Some one please help me
In a trigger, I have a code says go_block. How to return from the block and back to the trigger to continue executing the codes below the go_block statement? Please see example below, I want to come back from block CHECK_STUFF and continue execute the statements
:Name.option := '1';
if :name.option = '1' then
Example:
Block: Name
Item: yes_no - Key-next-item trigger
declare
begin
go_block('check_stuff');
go_item('answer');
:Name.option := '1';
if :name.option = '1' then
Thanks - PattyThe code behind the GO_BLOCK is executed immediately after the GO_BLOCK, it doesn't stop at that point. So you have to split your code, like
declare
begin
go_block('check_stuff');Then, create a procedure like
PROCEDURE PR_RETURN_FROM_BLOCK IS
BEGIN
go_item('answer');
:Name.option := '1';
if :name.option = '1' then
END;Then, when returning from the block (in whatever trigger you use), just call that procedure. -
How to return cursor from procedure to jdbc
plz help me through example of code as wl as procedure where.... return cursor from procedure to jdbc
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE procedure anil3 @count INT OUT,@opcode INT OUT,@total_tiff INT OUT
as
declare @query2 varchar(300),@tiff_count int,@query1 varchar(300)
set @query1='declare move_cursor cursor forward_only static for
select count(opcode),opcode from TABLE1 group by opcode
open move_cursor'
exec(@query1)
fetch next from move_cursor into @count,@opcode
set @opcode="'"+@opcode+"'"
set @total_tiff=0
while (@@fetch_status=0)
begin
set @query2='declare move_cursor2 cursor static for '+
' select count(tiff) from TABLE2 where opcode='+@opcode+
' open move_cursor2 '
exec(@query2)
fetch next from move_cursor2 into @tiff_count
while (@@fetch_status=0)
begin
set @total_tiff=@total_tiff+@tiff_count
fetch next from move_cursor2 into @tiff_count
end
close move_cursor2
deallocate move_cursor2
print @total_tiff
print @count
print @opcode
fetch next from move_cursor into @count,@opcode
end
close move_cursor
deallocate move_cursor
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO******************************************************************************
above this is sql server 2000 PL/SQL and i hv to get the value
print @total_tiff
print @count
print @opcode
through JDBC
plz help me out how to return Cursor to JDBC and HOW toPRINT THESE THREE VALUE @total_tiff, @count, @opcode through JDBC
get this values through JDBC -
How to return fault from Async BPEL
Hi,
I have ESB that has input,output and fault, This ESB calls Async BPEL that takes only input. Now i want to return fault from BPEL to ESB. How do i do it?
Please help.Hi,
My use case is i am implementing AIA. So my enterprise layer is ESB and my ABCS provider is BPEL. As provider takes lot of time to complete the instance, to avoid timeout issue i just created Async BPEL with two ports one for input another for fault. I am able to send back my fault back to this call back port. But how i can receive the fault to the same ESB which called the BPEL?
I am not able to implement it. I can not go for any workaround like creating one more BPEL and then make it as sync, put pick activity and receive the fault then send back to ESB.
Thats the reason i am very specific. If you find some solution please let me know. -
How to return fault from Async BPEL to ESB
Hi,
I have ESB that has input,output and fault, This ESB calls Async BPEL that takes only input. Now i want to return fault from BPEL to ESB. How do i do it?
Please help.Hi,
My use case is i am implementing AIA. So my enterprise layer is ESB and my ABCS provider is BPEL. As provider takes lot of time to complete the instance, to avoid timeout issue i just created Async BPEL with two ports one for input another for fault. I am able to send back my fault back to this call back port. But how i can receive the fault to the same ESB which called the BPEL?
I am not able to implement it. I can not go for any workaround like creating one more BPEL and then make it as sync, put pick activity and receive the fault then send back to ESB.
Thats the reason i am very specific. If you find some solution please let me know. -
How to return data from Ejb as collection to Front End application.
Hi,
I am creating a J2ee application. Here i am accessing BAPIs using stateless session bean through JCO connection. Now the BAPI is returning a return Table and return Structure to the EJB.
I have coded the following code in one of the Ejb Method as follows:
JCO.Table returnTable = null;
JCO.Structure returnStructure = null;
JCO.ParameterList paramList = siteBAPI.getExportParameterList();
JCO.ParameterList paramList2 = siteBAPI.getTableParameterList();
returnTable = paramList2.getTable("SITE_SUBSITE_INSTL");
returnStructure = paramList.getStructure("BAPIRET2");
Now i want to sent this data( returnTable & returnStructure) to front end application where front end developer accessing this returned data using Jsp.
My scenario is that , first i want to convert this returnTable & returnStructure in a single collection and then sent this collection to Front end.
My aim is that , the front end the application should not receive the Data, using JCO.table Variable but as a single Collection.
I am using NWDI-2004s sps10.
i need urgent help on this issue and i would really appreciate if somebody can put the answer with some sample code on how to return the data as Collection.if you want to return a result, then you probably shouldn't be using a message bean. message beans for for asynchronous tasks. session beans for for synchronous tasks. thus it would make much more sense to have your jsp call the session bean directly.
-
How to return error from subscription function of an event
I am creating a subscription function for an oracle shipped event, oracle.apps.eng.cm.changeObject.submit. The event fires fine, i can do my custom validations in this function. In case the validations fail, I need to return an error message.
As per the guides and metalink documents, the way to do this is by returning 'ERROR' . But even though I return an ERROR, it does not error out. Whether I return SUCCESS or ERROR , the behaviour is the same.
While creating the subscription function, for On Error , I selected, "Stop And Rollback ".
Is it possible to return errors from the subscription functions.
thanks
SatyaYou shouldn't be passing ResultSet objects across the EJB layer.
Instead you should be passing data back and forth.
All of the data access code should be in one place in one class.
That class should open the connection, run the query, process/store the results of the query and then close the connection.
In this case you probably want to return a list of something to your jsp.
So your EJB call should be more like
public List<resultBean> check(String id){
ResultSet rs = Statement.("select * from table1 where id=123");
List resultList = new ArrayList();
while (rs.next()){
Bean myBean = new Bean();
myBean.setProperty1(rs.getString("field1"));
myBean.setProperty2(rs.getString("field2"));
resultList.add(myBean);
return resultList;
} -
How to return Collection from from entity bean to servlet?
hi
is it possible to return Collection from entity bean (Which is returns form CMR field ) to servlet ?
thanksSERVLET
public class test extends HttpServlet {
@EJB
private LocalBean lookupBean;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
for(Item i : lookupBean.getMyCollection() )
out.println(i.getItemName());
out.close();
}BEAN INTERFACE
public interface BeanLocal {
Collection<Item> getMyCollection();
}BEAN IMPLEMENTATION
@Stateless()
public class Bean implements BeanLocal {
@PersistenceContext()
private EntityManager em;
public Collection<Item> getMyCollection() {
return em.createQuery("SELECT i from ITEM i").getResultList();
} and if you create an instance of your servlet you'll have to reinitialize LocalBean
@EJB(name="myejbref", beanInterface=BeanLocal.class)
private BeanLocal lookupBean;
private BeanLocal getLookupBean() {
if(lookupBean == null) {
try {
InitialContext ic = new InitialContext();
lookupBean = (BeanLocal) ic.lookup("java:comp/env/myejbref");
catch(Exception e){
System.out.println(e.getMessage());
return lookupBean;
} -
How to return values from a BSP page to Javascript
Hi All,
I want to call a BSP page which reads a single value from a table and returns that value I want the Javascript in the HTML code to get the value from the BSP page.
Can you kindly let me know how I can return the value from the BSP page to JavaScript.
Kindly please provide me a simple code of a BSP page and the Javascript
Thanks
KarenHi,
you need 3 elements to make the javascript code read the value in any field in the table: table´s name, line and column. This is how your code could look like:
script language="javascript>
var row = 0;
function display(){
row = row + 1;
campo = 'tabla1_' + row + '_4'; " <-- table, line, column
valor = document.getElementById(campo).value;
</script>
ROW works as a counter. You have in variable valor the value of the field and can do with it what you want, perhaps display it with ALERT. I am reading the values from field 1 to n in column 4 in table TABLA1. Pay attention to the '_' in the concatenation of field´s name. The table in my BSP is very simple:
<htmlb:tableView id = "tabla1"
table = "<%= mytable %>"
width = "100%"
allRowsEditable = "X"/>
and somewhere I must call function display in my javascript code:
<htmlb:button id="boton" text="Texto aqui" onClientClick="display()" />
So, give it a try. -
How to return Values from Oracle Object Type to Java Class Object
Hello,
i have created an Oracle Object Types in the Database. Then i created Java classes with "jpub" of these types. Here is an example of the type.
CREATE OR REPLACE TYPE person_type AS OBJECT
ID NUMBER,
vorname VARCHAR2(30),
nachname VARCHAR2(30),
geburtstag DATE,
CONSTRUCTOR FUNCTION person_type RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION person_type(p_id NUMBER) RETURN SELF AS RESULT,
CONSTRUCTOR FUNCTION person_type(p_vorname VARCHAR2,
p_nachname VARCHAR2,
p_geburtstag DATE) RETURN SELF AS RESULT,
MEMBER FUNCTION object_exists(p_id NUMBER) RETURN BOOLEAN,
MEMBER PROCEDURE load_object(p_id NUMBER),
MEMBER PROCEDURE save_object,
MEMBER PROCEDURE insert_object,
MEMBER PROCEDURE update_object,
MEMBER PROCEDURE delete_object
MEMBER PROCEDURE load_object(p_id NUMBER) IS
BEGIN
SELECT p.id, p.vorname, p.nachname, p.geburtstag
INTO SELF.ID, SELF.vorname, self.nachname, SELF.geburtstag
FROM person p
WHERE p.id = p_id;
END;
My problem is, that if i use the member function "load_object" from my java app it doesnt return the selected values to the java class and i dont know why. I use the java class like this:
PersonObjectType p = new PersonObjectType();
p.load_object(4);
There is a reocrd in the database with id = 4 and the function will execute successful. But if i try to use "p.getVorname()" i always get "NULL". Can someone tell me how to do that?
Thanks a lot.
Edited by: NTbc on 13.07.2010 15:36
Edited by: NTbc on 13.07.2010 15:36CallableStatement =
"DECLARE
a person_type;
BEGIN
a.load_object(4);
? := a;
END;"
And register as an out parameter.
Edited by: michael76 on 14.07.2010 05:01 -
2 Threads issues. How to return data from a thread located in other class
I have 2 questions.
This is the context. From main I start one thread that does a little job then starts another thread and waits for it to end to continue.
1) The last started thread needs to return a string to the Thread started from main. How can I accomplish that, because I read that I cannot use
synchronized methods outside different classes (and the threads belongs to different classes).
2) From the main thread I start the Second Thread located in another class like this ClassName obj = new ClassName(arg); obj.start(); obj.join()
Is that correct for waiting for the created thread to finish ?1) The last started thread needs to return a string to the Thread started from main. How can I accomplish that, because I read that I cannot use
synchronized methods outside different classes (and the threads belongs to different classes).Threads do not "belong" to classes. Class code executes in a particular thread. The class instances exist as long as something, somewhere, holds a strong reference to them.
So when you start a new thread, hold a strong reference to the object being executed by that thread. When the thread is done, retrieve your data from that object.
Even better, don't subclass Thread to create your objects. Instead, implement Callable, and use a ThreadPoolExecutor to execute it. -
How to return xmlType from Webservice generated with JDev and PL/SQL
Hi,
I have generated an PL/SQL package that's returning a value as xmlType.
With JDeveloper I'm deploying this package as a webservice. When invoking the webservice from a webbrowser the result looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:testXmltypeResponse
xmlns:ns1="http://app/webservice.wsdl"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="xsd:string">
<ROWSET>
<ROW>
<TODAY>12-OCT-07</TODAY>
</ROW>
</ROWSET>
</return>
</ns1:testXmltypeResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The problem is that the <return> tag contains 'xsi:type="xsd:string"'. And now the webservice response is not valid XML because the return value contains XML and not a string.
The solution would be, when invoking the webservice if the xsi:type would be missing from the result tag or would contains xsd:any. I tried editing the WSDL in JDeveloper and changing the type to xsd:any. After deploying and calling the WSDL from the webbrowser it contains this type. But when invoking the method from the webbrowser it still returns xsd:string as type.
How can I get rid of this type in the <return> or change it.
My JDeveloper version is 10.1.3.3.0 The Oracle database and 9iAS are 10.2.
Thanks in advance,
ThijsWhat version are you on?
Works fine for me on my 11g:
SQL> create or replace procedure testxml (clob_out out clob)
2 is
3 l_clob clob;
4 l_ctx dbms_xmlquery.ctxhandle;
5 begin
6 l_ctx := dbms_xmlquery.newcontext ('select * from dual');
7 l_clob := dbms_xmlquery.getxml (l_ctx);
8 clob_out := l_clob;
9 dbms_xmlquery.closecontext (l_ctx);
10 end testxml;
11 /
Procedure created.
SQL>
SQL> variable vout clob;
SQL>
SQL> exec testxml (:vout)
PL/SQL procedure successfully completed.
SQL>
SQL> print vout
VOUT
<?xml version = '1.0'?>
<ROWSET>
<ROW num="1">
<DUMMY>X</DUMMY>
</ROW>
</ROWSET>But definitely you can optimize your proc a bit: Try
create or replace procedure testxml (clob_out in out nocopy clob)
is
l_ctx dbms_xmlquery.ctxhandle;
begin
l_ctx := dbms_xmlquery.newcontext ('select * from dual');
clob_out := dbms_xmlquery.getxml (l_ctx);
dbms_xmlquery.closecontext (l_ctx);
end testxml;
/
Maybe you are looking for
-
How can I add an iCloud email alias?, How can I add an iCloud email alias?
I'm trying to figure out how to add an iCloud email alias but can't figure out where or how to. Please help.
-
Client Authentication error while invoking portal web service.
Hi All, I have created a java portal web service from portal service using NWDS, I am getting client authentication error while invoking the service. Please tell me where to enter client authenticity details. regards Santosh
-
How to use sql developer to connect informix
hi, everyone,i want to use sql developer to connect to informix database. i have added the informix jdbc driver,but when i create a new connection,i can't find the informix database. does it not support informix? please help. Edited by: 917391 on 201
-
Catalyst/Chromium causes screen to flash wildly then crashes computer.
I'm using catalyst-test-pxp 14.3-1 and chromium 35.0.1916.153-1. I am using 2 monitors. The main one being my laptop's screen (LVDS) to the right and my secondary screen (CRT1) to my left. Previously I had used a single screen configuration, however
-
Sales order - update line status to close the document with DTW
Hi everybody, yesterday i tried to update the line status of sales order lines from "O" to "C" with DTW. At first he ask me for DocRate. Then set DocRate to "1". After then DTW wrote, that I can't update the lines, during update the document... Can s