Cursor Oracle return only the last record
I am a newbie in oracle stored proc. I tried to select data using the slider, but it only return last record. The recording must be greater than 1.CREATE or REPLACE procedure MySchema.Test (myrefcur on sys_refcursor)
Is
Begin
declare
Cursor C1 IS
Select mySerialNum from TableA;
MyRecord C1% rowtype;
Begin
Open C1;
Loop
Fetch C1 into myrecord;
When the output C1% NotFound;
Open for Myrefcur
Select SerialNumB from TableB where SerialNumB = myrecord.mySerialNum;
End loop;
Close C1;
End;
end;
However, it only returns the last record in the list.
Original case *.
The original code is as below:
1st, I'll need to select a list of ImageSerialNum of ImageSerial
* 1 query:
Select A.ImageSerialNum from ImageSerial A, ProductionOrder B, Bom C
Where A.ProductionOrderID = B.ProductionOrderID And B.Assembly_Num = C.Model_Num and
B.Revision = C.Revision And B.EngRevision = C.EngRevision and
C.Bom_ID = passInVariable* and C.FactoryID = "7"
2nd, I'll need to check the process of EACH series with the code below:
* Low code a return process for 1 series only.
Select t.processid, t.processname, t.assembly_num, t.revision, t.engrevision of
(Select p.ProcessID, p.ProcessName, in. Assembly_Num, in. review, in. EngRevision, im.imageserialnum
Process p, Routesequence rs, Imageserial im, ProductionOrder in.
Where im. ImageserialNum = SerialNum* and p.ProcessID = rs. ProcessID
And rs. RouteID = in. RouteID and rs. SequenceID = im. NextRouteSequence
And in. ProductionOrderID = im. ProductionOrderID AND IM. STATUS OF '0'
UNION
SELECT A.REWORKROUTEID AS PROCESSID PROCESSNAME AS B.ROUTENAME, C.ASSEMBLY_NUM, C.REVISION, C.ENGREVISION, a.imageserialnum
OF IMAGESERIAL A, B OF ROAD, PRODUCTIONORDER C
WHERE A.REWORKROUTEID = B.ROUTEID AND A.IMAGESERIALNUM = SerialNum*.
AND A.PRODUCTIONORDERID = C.PRODUCTIONORDERID and a.status = '0') t
After that, I would like to combine the two in 1 stored proc code.
in this case, you just want to join the two applications to use in the FROM clause
As I don't have your tables, I created two tables, each representing the results of your queries. Substitute the names of table with your queries
SQL> drop table master
2 /
Table dropped.
SQL> drop table details
2 /
Table dropped.
SQL>
SQL> create table master
2 (ImageSerialNum varchar2(25));
Table created.
SQL>
SQL>
SQL> insert into master values ('Serial1');
1 row created.
SQL> insert into master values ('Serial2');
1 row created.
SQL> insert into master values ('Serial3');
1 row created.
SQL> insert into master values ('Serial4');
1 row created.
SQL> insert into master values ('Serial5');
1 row created.
SQL>
SQL> create table details
2 (ImageSerialNum varchar2(25)
3 ,ProcessID number
4 ,ProcessName varchar2(25)
5 );
Table created.
SQL>
SQL> insert into details values ('Serial1', 1, 'Process1');
1 row created.
SQL> insert into details values ('Serial3', 3, 'Process3');
1 row created.
SQL> insert into details values ('Serial5', 5, 'Process5');
1 row created.
SQL>
SQL> select m.imageserialnum
2 , d.processid
3 , d.processname
4 from master m
5 left outer
6 join details d
7 on (m.imageSerialnum = d.imageserialnum)
8 order by m.imageserialnum
9 /
IMAGESERIALNUM PROCESSID PROCESSNAME
------------------------- ---------- -------------------------
Serial1 1 Process1
Serial2
Serial3 3 Process3
Serial4
Serial5 5 Process5
your query will be something like
select m.imageserialnum
, d.processid
, d.processname
from () m
left outer
join (
Tags: Database
Similar Questions
-
Need help to write a MySQL query that returns only the peer matching records
Because I don't know how to explain it easily, I use the table below as an example.
I want to create a MySQL query that returns only the records that match counterparts where 'col1' = 'ABC '.
Notice the ' ABC / GHI' record does not have a Counter-match ' GHI / ABC' record. This record must not be returned because there is no Counter-Party correspondent. With this table, the ' ABC / GHI' record should be the one returned in the query.
How can I create a query that will do it?
ID | col1 | col2
--------------------
1. ABC | DEF
2. DEF | ABC
3. ABC | IGS
4. DEF | IGS
5. IGS | DEF
* Please let me know if you have no idea of what I'm trying to explain.I wanted to just the results where col1 = ABC, but I already got the answer I needed on another forum. Thank you anyway.
SELECT a.col1,
a.col2
FROM table_name AS a
LEFT OUTER
Table_name JOIN b
ON b.col1 = a.col2
AND a.col1 = b.col2
WHERE b.col1 IS NOT NULL AND a.col1 = 'ABC '. -
remove the last record from the plsql table
Under certain conditions, I need to remove the last record from i_CustomerLoopTYPE r_LOOPElement IS RECORD (TermID NUMBER ); TYPE t_LOOPType IS TABLE OF r_LOOPElement INDEX BY BINARY_INTEGER; i_CustomerLoop t_LOOPType ; i_CustomerLoop(1).TermID=1; i_CustomerLoop(2).TermID=2; i_CustomerLoop(3).TermID=3;
whichi s the best way to do it. because I sometimes get duplicates for TermID in this plsql table.Hello
See [removing items from Collection (DELETE method) | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/collections.htm#CJAFGFIG]
Kind regards
-
What function can I use to return only the decimal value of a formula
(97 * 2.2) / 14 value returns 15.24
I only want to use le.24
Salvation is
Use the formula - INT (formula)
In the special case above:
=(97*2.2)/14 - INT ((97*2.2)/14)
You see two places to the right of the decimal separator in reason to be rounded off to the value real, in the shape of the cell to only show as two decimal places, either by setting the width of the cell close enough to force the rounding of the displayed value.
Note that if the result is rounded (using the ROUND function) the actual value of the cell will be the rounded value. For the other two cases, the value displayed indicates only two decimal places, but the real value in the cell (and the additional calculations used by referring to this cell) is 0.242857142857144, which could lead to surprises in the results of the calculations downstream.
Kind regards
Barry
-
How to set up the multimedia keys (only the last 3 buttons)
Hello
How to set up the multimedia keys (only the last 3 buttons)? The first button works, you open the browser and the other open WMP.
But the last 3 buttons (play/pause, Stop, forw/rewd) aren´t work with WMP. How can I fix?Thank you
Hello
Can you please tell us what model of laptop Satellite A do you have?
-
a table of images only the last image shows the index
Hello world
I try to index a table of images and all, but the last item gives me the error: "not an image."
Here is a picture of the vi. The first loop load images and stores them in an indexed auto tunnel. Each diagnosis that I fell on this loop showed that all is well. The second loop must display the image stored in the tunnel sequence indexed auto, but it does not work. Instead, I got the error message that the 0 to n - 1 elements are not images, and only the last image is displayed.
What I am doing wrong?
Thanks for your help.
and vi:
Hello
This VI has worked well for me with a contribution of 5 bmp files. You can check your input files?
-
I can see only the last fax received in my PC and not all of them using an Officejet Pro 8600 Plus
I create a file in my office where received faxes can be saved. Indeed, I can see the fax received, but if I get one more, it replaces the previous one. So, I see only the last received fax. How do I see all of them and does not replace another?
The problem was that I didn't set the time on the machine of the printer. I just put the date and time and the problem solved. I get faxes pdf correctly. Be it, thanks for the help!
-
Will be able to choose only the last the last row in a window/desktop icon in Windows 7
I use my laptop with Windows. Recently I could not open the icons/files you want in the Office of a window.
I may be able to choose only the last the last row in a window/desktop icon in Windows 7.Although double-clicking on an icon only the last icon in the window opens. Pls help me...Hi Peter,.
1 when was the last time that the desktop icons worked?
2. you have any security program installed on the computer?
3. don't you face any performance issues on the computer?
4 did you a recent software or changes to the material on the computer?
Method 1:
I would say allowing you to run the FIXIT from the link provided and check.
Difficulty of broken desktop shortcuts and common system maintenance tasks
http://support.Microsoft.com/mats/system_maintenance_for_windows/en-us
Method 2:
If the problem persists, you can also run the Scanner security Microsoft and check all infections.
http://www.Microsoft.com/security/scanner/en-us/default.aspx
Note: there is a risk of data loss if all the files are infected and which can be removed in the cleaning process.
Method 3:
I also suggest to try to run the System File Checker scan on the computer. The scan will replace all the Windows files corrupted with new ones.
Click on the link mentioned below for further guidance on the scanning of the file system Checker
http://support.Microsoft.com/kb/929833
Hope this helps and let us know if you need more assistance. We will be happy to help you.
-
Select the last record of each month
Hello
to select the last docnumber and qty of every month
Structure
Name Null? Type
------------------------------- -------- ----
PRODUCTCODE NUMBER
NUMBER NUMBER
DATE OF PLANFORMONTH
NUMBER OF CLEXPECTEDQTY
NUMBER OF CLCONFIRMQTY
NUMBER OF CLFGBUFFERQTY
NUMBER OF CLTOTPRINTBUFFER
in this select query if I take the sum he required all records where, as I want the last record of each month
SELECT productcode docnumber MAX (Number), planformonth, SUM (clexpectedqty) clexpectedqty (planformonth) MAX.
SUM (clconfirmqty) clconfirmqty, SUM (clfgbufferqty) clfgbufferqty, cltotprintbuffer OF FGSALESPLAN of the SUM (cltotprintbuffer)
GROUP BY productcode, (planformonth)
Sandy
Hello
Thanks its working now the code is written as below:
SELECT * FROM
(SELECT
e.*,
ROW_NUMBER() OVER (partition by PRODUCTCODE by DOCNUMBER DESC order) r
Of
E FGSALESPLAN)
WHERE r = 1 AND
entryvalid = 'Y '.
order by Number
Sandy
-
CreateInsert operation creates only the first record in a table
Hi experts,
I use Jdev 12.1.3 and Alta UI, and I have a table with a button that calls the CreateInsert operation:My problem is that only the first record is created. If the user presses the button twice or more, new records does not appear.
<af:panelCollection id="pc1" styleClass="AFStretchWidth" featuresOff="viewMenu detach"> <f:facet name="toolbar"> <af:toolbar id="t3"> <af:button actionListener="#{bindings.CreateInsertTonYear.execute}" text="Add New Record" id="b1"/> </af:toolbar> </f:facet> <af:table value="#{bindings.HbtProductTonsYear.collectionModel}" ... partialTriggers="::b1" > ... </af:table> </af:panelCollection>
Any ideas?
Kind regards
Jose.
Try to make the button refresh panelCollection (set panelCollection partialTriggers ID button)
-
Discover with function as datasource returns only the first line.
Hello
I created the following function to get the status of all the rules for the instances of SQL Server.
The data type of the function output has been configured as 'List of SQLInstanceRuleStatuss', where SQLInstanceRuleStatuss is the custom type, I created in the same module.
When I tested the function, it returns all instances of SQL Server with two other columns.
But when I try to create a view with the Rows property that is configured to use the feature, it returns only the first line:
sqlRules = new ArrayList();
queryStatement = server. QueryService.createStatement ("(DBSS_Instance)");
queryResult = server. QueryService.executeStatement (queryStatement);
for (it in queryResult.topologyObjects)
{
sqlRule is functionHelper.createDataObject ("westjet_mark_dev:SQLInstanceRuleStatus", "none", "test");.
sqlRule.instance = it;
sqlRule.ruleName = 'test rule name';
sqlRule.status = false;
sqlRules.add (sqlRule);
}
Return sqlRules;
Did I miss something?
Thank you
Mark
Mark,
I think I forgot something
sqlRule=functionHelper.createDataObject("westjet_mark_dev:SQLInstanceRuleStatus","none","test");
you create the test id
change your line of
sqlRule=functionHelper.createDataObject("westjet_mark_dev:SQLInstanceRuleStatus","none",null);
This should allow the creation of a single object in your loop for
-
Add a string to the last record
Hello
I was just trying to format an o/p to a table, and looking at the result, I thought it would be nice to add a piece of a chain to the last record. For example
with dat as ( select 'First Record' as COL from DUAL union all select 'Second Record' from DUAL union all select 'Third Record' from DUAL union all select 'Nth Record' from DUAL ) select * from dat o/p Desired o/p COL COL ------------- ------------- first RECORD first RECORD second RECORD second RECORD THIRD RECORD THIRD RECORD NTH RECORD This is the last record NTH RECORD
with dat as ( select 'First Record' as COL from DUAL union all select 'Second Record' from DUAL union all select 'Third Record' from DUAL union all select 'Nth Record' from DUAL ), ord as ( select count(*) rn from dat ) select decode(rownum, rn, 'This is Last Record ' || col, col) from ord, dat;
-
Function call only the last Javascript API
All,
I have a function in my page header:
function DisableANo() {}
1
$f_DisableOnValue ('P20_B', 'AAAA', 'P20_A');
2
$f_DisableOnValue ('P20_B', 'BBBB', 'P20_A');
3
$f_DisableOnValue ('P20_B', 'CCCC', 'P20_A');
}
I call this function onChange event of the B element.
When I do this, only the last API //3 is called. If I delete //3 and have only //1 and / / 2, then I get //2 to work and if I remove //2 and I only / / 1, then I can get //1 to work.
Can you please tell me where I'm wrong?
Thank you!Spriya wrote:
HelloI am trying to disable the P20_A element if the value of the P20_B element is "YYYY" or "BBBB" and "CCCC".
Review of documentation:
>
$f_DisableOnValue (pThis, pValue, pThat)Checks the value (pValue) of an element (pThis). If it matches, this feature disables the element or the array of items (pThat). If it does not match, the item is enabled.
>
In this code (and code should always be validated using ------)...\
Tags :)
function DisableANo(){ //1 $f_DisableOnValue('P20_B','AAAA','P20_A'); //2 $f_DisableOnValue('P20_B','BBBB','P20_A'); //3 $f_DisableOnValue('P20_B','CCCC','P20_A'); }
If P20_B is "YYYY" //1 will disable P20_A, then because P20_B is "YYYY", //2 will allow to P20_A because P20_B! = "BBBB"etc etc...
Try $x_disableItem:
$x_disableItem('P20_A', (($v('P20_B') === 'AAAA') || ($v('P20_B') === 'BBBB') || ($v('P20_B') === 'CCCC')))
-
Master page link to a details page displays only the first record
Hello
Could someone tell me please how to fix this problem:
I have a master page that lists all users of my, and I have links next to them to take them to the specific user details. However, the links of all other records only show details for the first record.
This is the link that is supposed to brings me to the details page:
< a href = "patientlist2.php? Patient_id = <? PHP echo $row_rsPatients ["Patient_id"];? > "> <?" PHP echo $row_rsPatientlist ["Patient_id"];? > < / a >
I have the same problem when you try to update the files, only the first record will appear.
I'd appreciate any help.
Thank you
There is probably something wrong with your recordset. Test the query in the window of recordset for the generation of game records to ensure that you get the results desired of the recordset before placing and repeat on the page.
-
What is the best way to get the last record in a table?
... in addition to select * from tbl by id Desc... & then set = 1 maxrow in cfoutput.
I want a quick way.
I tried "Max (id), columns, but not worked.
If I ' Max (id) as V ' & then turn around and make another request for ' where id = #V # "to get the rest of the record, there's more action.
Quote:
Posted by: paross1
One way...SELECT all your columns
From your_table
WHERE your_engagement_appid = (SELECT MAX (your_id)
From your_table)Phil
Thank you guys. It worked great.
I also tried the front joined query where the... I would have thought that.
Thank you!
Maybe you are looking for
-
I don't know if it's a coincidence that he himself has updated to 37.0, but it must be... When I click the task bar on Firefox and on the desktop icon, it opens on the taskbar, when I select the taskbar it shows even Firefox loaded Google (my default
-
Get blue screen errors. My hard drive died?
Original title: hard drive crash? Finally, my hard drive failed? A few months ago, I had a virus so I had to back up my entire hard drive on my Toshiba laptop. After I did this whenever I started it, I had to press F12 to load device of your choice.
-
When you try to open a PDF file, Windows Media Center opens
My aunt has Windows Vista on her computer and whenever she tries to open a pdf file that opens Windows Media Center. Is there a way to get Windows Vista to point to Acrobat Reader to open the file, or should it go directly to the RA? Thanks for any h
-
Windows Media Center Library Extras will be included in Windows 10 Upgrade?
Given that Windows Media Center will not appear in Windows 10 games Extras library (Chess Titan, Mahjong Titans, Solitaire, etc.) will be available in Windows 10? If not, can be downloaded or extracted from Windows 7.
-
Unable to send email using Windows Live Mail and Windows 7 through Charter
When you use Windows Live Mail with Windows 7, I have and receive mail properly but don't can't send e-mail. Charter is my ISP. I get the following message I've confirmed the settings of e-mail with Charter and they say it's Ms. problem with Live M