How to fetch indivdual rows from a dynamic query.
Hi,
I wish to fetch the individual rows returned from a dynamic query.
if my dynamic query is:
dyn_stmt := select col1, col2, col3
from tab1;
The query returns multiple rows.
Then how to fetch individual rows of this query ?
Please explain.
declare
cur_test sys_refcursor;
c1 varchar2(30);
c2 number;
c3 date;
begin
dyn_stmt := select col1, col2, col3 from tab1;
OPEN cur_test FOR dyn_stmt;
LOOP
FETCH cur_test INTO c1, c2, c3;
IF cur_test%NOTFOUND THEN
EXIT;
END IF;
-- Process this row
END LOOP;
CLOSE cur_test;
END;
Similar Messages
-
How to delete multiple rows from ADF table
How to delete multiple rows from ADF table
Hi,
best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
Frank -
How to update duplicate row from table
Hi,
how to update duplicate row from table?
First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
can you give me suggestion on it?
Thanks in advance.
your early response is appreciated...In order to find a duplicate row, see:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
(or search this forum, your question has been asked before)
In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase. -
How To Delete a Row From a TableView !!!!
Hi,
Does any know how to delete a row from a table view model.
I have a TableViewModel being displayed, when the user select the particular row and click delete i want that particular row to be deleted.
Any Suggestions How.
Thanks,
Emmanuel.If u want to delete single row, then set the property of TableView - selectionMode="SINGLESELECT". Select the radio button and click on delete button. In the main program, you can get the row value like...
public void onDeleteButtonClicked(Event event) throws PageException {
TableView table = (TableView) this.getComponentByName ("idTableView");
DefaultTableViewModel dmodel = myBean.beanModel;
String pid = "", row_selected;
// Get the first visible row
int firstVisibleRow = table.getVisibleFirstRow();
// Get the last visible row
int lastVisibleRow = table.getVisibleLastRow();
for (int i = firstVisibleRow; i <= lastVisibleRow; i++) {
if (table.isRowSelected(i)) {
row_selected = i;
pid = dmodel.getValueAt(i, 1).toString();
"i" will give you the row no, pid has the value of the row at first column.
Hope this helps.
Thanks,
Praveen -
How to "discard" a row from a view
It seems to me like a simple thing, but I can't find an answer:
I want to programmatically remove a row from an executed view's rowset, but I don't want the underlying entities removed?
[I don't want any pending updates to the entities affected either. It's basically a UI thing - the user does something and I want to make the current row vanish. I don't need or want to re-execute or alter the database as a result of this particular removal.]
Anyone know of a vo.removeRowWithoutAffectingEntities method?
Thanks,
Mike.Found an old thread myself.
How to remove a row from a rowset
Will have to give this "hack" a try, I guess. (Sung, has this API been introduced into an unreleased version yet?)
I had already tried overriding the updateable-entities' remove methods (which are called from row.remove()), but it seems that the view-row hangs around if the entities aren't actually removed. Found some "removeEntityReferences (i.e. set them to null)" method on a QueryCollection and was wondering if calling that followed by a row.remove() might do the trick, but the method's protected anyway. Might still see if I can call it somehow. Any comments on the viability of this, Sung? (Given that the previous work-around was "uncharted territory"....)
Anyway, I guess I'll give the original work-around a shot. (Or make application non-ideally commit and requery!)
Mike. -
Cannot fetch a row from OLE DB provider "BULK" with bulk insert task
Hi, folks:
I created a simple SSIS package. On the Control Flow, I created a Bulk INsert Task with Destination connection to a the local SQL server, a csv file from a local folder, specify comma delimiter. Then I excute the task and I got this long error message.
[Bulk Insert Task] Error: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.".I got the same error with some additional error details (below). All I had to do to fix the problem was set the Timeout property for the SQL Server Destination = 0
I was using the following components:
SQL Server 2008
SQL Server Integration Services 10.0
Data Flow Task
OLE DB Source – connecting to Oracle 11i
SQL Server Destination – connecting to the local SQL Server 2008 instance
Full Error Message:
Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E14.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E14 Description: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E14 Description: "The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E14 Description: "The Bulk Insert operation of SQL Server Destination has timed out. Please consider increasing the value of Timeout property on the SQL Server Destination in the dataflow.".
For SQL Server 2005 there is a hot fix available from Microsoft at http://support.microsoft.com/default.aspx/kb/937545 -
hi
i'd like to ask question about linked server.
my linked server used to work but now when i try to select from linked server i was told "The OLE DB provider for linked server reported an error. The provider reported an unexpected catastrophic failure Cannot fetch a row from OLE DB provider
for linked server"
but in fact for test connection i was told "the test connection to the linked server succeeded".
could anyone help me? thank u very much
best regards
martinHi,
In addition to Tracy's post we have to know those answers as well:
* what provider are you using for the connection
* what do you connect to
for example, if someone try to connect to oracle using sql server provider then several simple queries are going to work probably OK, but once you are trying to use T-SQL or any complex SQL query then the errors are starting.
please post the connection string (without the password!) + the query that you are trying to use.
[Personal Site] [Blog] [Facebook] -
How to compare two rows from two table with different data
how to compare two rows from two table with different data
e.g.
Table 1
ID DESC
1 aaa
2 bbb
3 ccc
Table 2
ID DESC
1 aaa
2 xxx
3 ccc
Result
2Create
table tab1(ID
int ,DE char(10))
Create
table tab2(ID
int ,DE char(10))
Insert
into tab1 Values
(1,'aaa')
Insert
into tab1 Values
(2,'bbb')
Insert
into tab1 Values(3,'ccc')
Insert
into tab1 Values(4,'dfe')
Insert
into tab2 Values
(1,'aaa')
Insert
into tab2 Values
(2,'xx')
Insert
into tab2 Values(3,'ccc')
Insert
into tab2 Values(6,'wdr')
SELECT
tab1.ID,tab2.ID
As T2 from tab1
FULL
join tab2 on tab1.ID
= tab2.ID
WHERE
BINARY_CHECKSUM(tab1.ID,tab1.DE)
<> BINARY_CHECKSUM(tab2.ID,tab2.DE)
OR tab1.ID
IS NULL
OR
tab2.ID IS
NULL
ID column considered as a primary Key
Apart from different record,Above query populate missing record in both tables.
Result Set
ID ID
2 2
4 NULL
NULL 6
ganeshk -
How to fetch the data from Ecc to BI ?
Hi everybody.
Can anyone briefly explain with the screen shots > How to fetch the datasource from RSA5 tcode in ECC to BI? How you replicate there? how the INFO PACKAGE , TRANSFORMATIONS, DTP , DSO, INFO CUBE was created? where we see the catalogs for this data.......THANKS IN ADVANCEHi.
You can follow the below steps to fetch the data from ECC to BI System.
1>Connection should be there between ECC and BW System.
2>Go to Tcode-RSA5 in ECC system and find your data source and then activate it.
3> Go to Tcode-RSA6 in ECC system to check whether your DS is available..if it is there then its been activated.
4>Go to Extract Checker tcode RSA3 and test the data and make sure data is correct.
5>login to BW Side..go to tcode RSA1-->Choose your source system. ECC -> double click on it and you will move to Data source>Select your Application component ex, SD,FI ...>Right click and replicate the Datasouce> Now on refresh you can see the datasource in BI System.
6>Install the related the Infoprovider .. cube or dso ..Connect the datasouurce and create Transformation.
7> Now create infopackage and run it in ful & init mode then do the delta for the new records.
Please refer the below link for more details on extraction.
http://www.trinay.com/SAP%20BW%20Extraction.pdf
Hope this helps.
Br.
Alok -
How i will retrive rows from object type
test is object type(varchar2,varchar2)
test1 is a object derived from test
test1(varchar2,varchar2,test);
how i will retrive rows from test1.
declare
type recf is ref cursor;
v_tab test1 := test1('a','b',test('c','d'));
rec recf;
begin
open rec for
select * from table(cast(v_tab as test1));
dbms_output.put_line('the rows are'||rec.test1.test11);
end;
when i compile this it return
ERROR at line 7:
ORA-06550: line 7, column 35:
PL/SQL: ORA-22907: invalid CAST to a type that is not a nested table or VARRAY
ORA-06550: line 7, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 8, column 48:
PLS-00487: Invalid reference to variable 'REC'
ORA-06550: line 8, column 1:
PL/SQL: Statement ignored
error.hi ur previous example really helping me but please help me in this current senario,
PROCEDURE reserveNumbers (
TheNumberRange IN NumberRange,
UserID IN userid,
ReturnStatus OUT CallStatus ); which is in P_Numbermgr_Api package.
here NumberRange is a object
TYPE NumberRange IS OBJECT (
StartNumber VARCHAR2(40),
EndNumber VARCHAR2(40),
NumberAttributes NumberAttr)
NumberAttributes field based on NumberAttr object
TYPE NumberAttr IS OBJECT (
NumberType VARCHAR2(15),
CountryCode VARCHAR2(10),
CityCode VARCHAR2(3))
i write a package within package i am calling P_Numbermgr_Api.reserveNumbers:
CREATE or replace TYPE My_numberrange IS TABLE OF numberrange;
CREATE OR REPLACE PACKAGE numberrange_wrapper AS
TYPE cursor_type IS REF CURSOR;
TYPE cursor_type1 IS REF CURSOR;
TYPE cursor_type2 IS REF CURSOR;
v_userid number;
PROCEDURE Getnumberrange (userid IN number,
p_recordset OUT numberrange_wrapper.cursor_type);
END numberrange_wrapper;
within package body i write
CREATE OR REPLACE PACKAGE body numberrange_wrapper AS
PROCEDURE Getnumberrange (userid IN number,p_recordset IN OUT numberrange_wrapper.cursor_type)
is
v_tab My_numberrange := My_numberrange();
refc numberrange_wrapper.cursor_type2;
BEGIN
numberrange_wrapper.v_userid:= userid;
OPEN p_recordset FOR
SELECT
* FROM
Table(Cast(v_tab As My_numberrange));
P_Numbermgr_Api.reserveNumbers (My_numberrange,v_userid,p_recordset);
END Getnumberrange;
end numberrange_wrapper;
it return
PLS-00330: invalid use of type name or subtype name
please help me how i will solve this problem -
How To Question: Can I fetch a row from database and show it as link,on click of thi
Hi:
I am trying to get a row set from database, display it as link/ hotspot then upon clicking of this link to delete that particular row from the database.
I would appreciate if someone there could give some pointers.
Thanks in Advance
Ajith
nullIn each row of your table, you need to construct a HREF that submits to a servlet (or JSP) with a GET parameter that references the primary key for that row, e.g.
<td><a href="delete.jsp?rowid=15">Delete</a></td>The delete.jsp can execute the delete and then forward to the display.jsp to redisplay the resultset after requerying the database.
John H. -
How to fetch a row with maximum rownum
In my sql query, how can i fetch the row with max row count? the query has around 10 columns.
Thank You
KKHi,
It's not very clear what you want.
It sounds like you want a Top=-N Query , perhaps like this:
WITH got_row_cnt AS
SELECT job
, COUNT (*) AS row_cnt
-- , ... -- other columns
, RANK () OVER (ORDER BY COUNT (*) DESC) AS rnk
FROM scott.emp
GROUP BY job
SELECT * -- or list all columns except rnk
FROM got_row_cnt
WHERE rnk = 1
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
How to select multiple rows from List Of Values
Hello,
I use ADF 11g to create my list of values (LOV). I want to select multiple rows from it. but i can't.
so how i can select many rows to set them in my adf table.
Thank in advanceHi,
LOV is map to an attribute in the viewObject so it will return only one value or more values from selected row. You can't select multiple rows from LOV.
But you can do this by using popup which you can select multiple rows and insert the selected rows to another table.
This blog post explain how to achieve this :
http://husaindalal.blogspot.com/2009/11/search-from-popup-and-add-to-new-table.html#comments
Sameh Nassar -
How to get selected row from a non-bind ADF table
Hi,
I have an ADF table that is based on a collectionModel built programmatically. The collectionModel is this:
model = new SortableModel(new ArrayList<ArrayList>());
Hence, it is not a binding table. My question is how to get the selectedRows from a non-bind table.
I am used to building binding ADF table and I know we can get it from voiterator.getCurrentRow, since the selectionListener is set to the binding....collectionModel.makeCurrent
<af:table value="#{bindings.ItasLookupTypesVO1.collectionModel}"
selectedRowKeys="#{bindings.ItasLookupTypesVO1.collectionModel.selectedRow}"
selectionListener="#{bindings.ItasLookupTypesVO1.collectionModel.makeCurrent}"
</af:table>
I am thinking maybe I need to write my own selectionListener, but need more advice/ideas of what's the codes in the customer selection Listener to get it from my SortableModel.
Please help.
Thanks
-MinaI'm not sure if this works in your case, but check out the selection listener I write in this blog http://wp.me/pcBZk-eu
You should use the selection event and check the added set. This should give you access to the selected row.
Timo -
HOW TO DELETE THE ROW FROM DATABASE
hI,
Iam pasting my code below.My problem isi retrieve rows from database and display them in jsp page in rows.For each row there is delete hyperlink.Now when i click that link i should only delete the row corresponding to that delete link temporarily but it should not delete the row from database now.It should only delete the row from database when i click the save button.How can i do this can any one give some code.
thanks
naveen
[email protected]
<%@ page language="java" import="Utils.*,java.sql.*,SQLCon.ConnectionPool,java.util.Vector,java.util.StringTokenizer" %>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Item Details</title>
<script>
function submitPage()
document.details.action = "itemdetails.jsp" ;
document.details.submit();
</script>
</head>
<body>
<form name="details" action="itemdetails.jsp" method="post">
<%
ConnectionPool pool;
Connection con = null;
Statement st;
ResultSet rs =null;
%>
<table border="0" cellpadding="0" cellspacing="0" width="328">
<tr>
<td width="323" colspan="4"><b>Reference No :</b> <input type="text" name="txt_refno" size="14">
<input type="submit" value="search" name="search" ></td>
</tr>
<tr>
<td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item Code</b></font></td>
<td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item No</b></font></td>
<td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Amount </b></font></td>
<td width="80" bgcolor="#000099"> </td>
</tr>
<%
pool= new ConnectionPool();
Utils utils = new Utils();
double total =0.00;
String search =utils.returnString(request.getParameter("search"));
if(search.equals("search"))
try
String ref_no =utils.returnString(request.getParameter("txt_refno"));
String strSQL="select * from ref_table where refno='" + ref_no + "' ";
con = pool.getConnection();
st=con.createStatement();
rs = st.executeQuery(strSQL);
while(rs.next())
String itemcode=rs.getString(2);
int item_no=rs.getInt(3);
double amount= rs.getDouble(4);
total= total + amount;
%>
<tr>
<td width="81"><input type=hidden name=hitem value=<%=itemcode%>><%=itemcode%></td>
<td width="81"><input type=hidden name=hitemno value=<%=item_no%>><%=item_no%></td>
<td width="81"><input type=hidden name=hamount value=<%=amount%>><%=amount%></td>
<td width="80"><a href="delete</td>
</tr>
<%
}catch(Exception e){}
finally {
if (con != null) pool.returnConnection(con);
%>
<tr>
<td width="323" colspan="4">
<p align="right"><b>Total:</b><input type="text" name="txt_total" size="10" value="<%=total%>"></td>
</tr>
<tr>
<td width="323" colspan="4">
<input type="button" value="save" name="save"></td>
</tr>
</table>
</form>
</body>
</html>You mean when you click on the hyperlink you want that row to disappear from the page, but not delete the row from the database until a commit/submit button is pressed?
Personally, I think I'd prefer that you have a delete checkbox next to every row and NOT remove them from the display if I was a user. You give your users a chance to change their mind about their choice, and when they're done they can see exactly which rows will be deleted before they commit.
You know your problem, of course, so you might have a good reason for designing it this way. But I'd prefer not removing them from the display. JMO - MOD
Maybe you are looking for
-
Why can I no longer transfer files to an external HD?
To make more space on my 2010 macbook air (OS 10.9.4) I purchased a Toshiba 1TB external hard drive (formatted Mac OS Extended (Journaled). To free space I placed a large folder onto it, and also set up Time Machine. When I plugged it in a few days l
-
Problems connecting RAZR via Bluetooth
Hey guys... I have an iBook G4 1.33MHz running 10.4.7 but, for some reason, my RAZR will not pair with my iBook. It just will flat out not discover it. I go to my phone, click on discoverable, and let that run. Meahwhile, I run the wizzard to connect
-
Itunes not installed correctly error 7, itunes not installed correctly error 7
When I updated itunes, it did not installcorrectly. I get " C:\Program files (x86)|iTunes|iTunes.exe R6034. An application has made an attempt to load the C runtime Library incorrectly Then when I retry, and it tries to load , I get " iTunes not
-
ABAP Add-on certification on sub-contractor system
Hi all, My company has some ABAP Add-on, which was developed for us by an outsourcing contractor on his system based on our design and instructions. This Add-on and all code sources are our property of course. Now we wish to certify this ABAP Add-on
-
How do I create a simple message board (forum)
I am a BC new-bee. How do I create a simple message board (forum) in BC to use on a Muse site since no widget is available there.