How can i select the rows from the 3 tables by particular column name?
Vehicle Passing Summary table structure
PsngSmry_ID(Number),Vehicle_iD(Number),PsngSmryTime(datetime)
Vehicle table structure
Vehicle_iD(Number),VehicleName(VarChar2),VehicleType(VarChar2)
Here Vehicle_iD is the Primary Key
Equipment Table Structure
Eqpmt_id(Number),Vehicle_iD(Number),EqpmtName(VarChar2),EqpmtType(VarChar2)
Here Eqpmt_id is the Primary Key and Vehicle_iD is the foreign Key
Equipment Component Table Structure
Eqpmt_Cmpnt_id(Number) ,Eqpmt_id(Number),EqpmtCmpntName(VarChar2),EqpmtCmpntName(VarChar2),Parent_Eqpmnt_ID(Number)
Here Eqpmt_Cmpnt_id is the Primary Key and Eqpmt_id is the foreign Key
The rows in the Vehicle Passing Summary table
PsngSmry_ID Vehicle_ID PsngSmryTime
111111 80986246 2010/10/11
111112 80986247 2010/10/12
111113 80986248 2010/10/10
The rows in the Vehicle Table
Vehicle_iD VehicleName VehicleType
80986246 Lorry Four Wheeler
80986247 Van Four Wheeler
80986248 Bus Four Wheeler
The rows in the Equipment Table:
Eqpmt_id Vehicle_iD EqpmtName EqpmtType
109846 80986246 2 Axle Lorry CAR
109821 80986246 4 Axle Lorry CAR
109825 80986246 4 Axle Lorry CAR
109562 80986247 2 Axle VAn CAR
109555 80986247 3 Axle VAn CAR
109777 80986247 3 Axle VAn CAR
109587 80986248 2 Axle Bus CAR
The rows in the Equipment Component Table :
Eqpmt_Cmpnt_id Eqpmt_id EqpmtCmpntName Parent_Eqpmnt_ID
20904146 109846 Truck
20904147 109846 Truck
20904148 109846 Axle 20904146
20904159 109846 Axle 20904146
20904167 109846 Wheel 20904148
20904177 109846 Wheel 20904148
20904185 109846 Wheel 20904159
20904325 109846 Wheel 20904159
20904188 109846 Axle 20904147
20904189 109846 Axle 20904147
20904195 109846 Wheel 20904188
20904196 109846 Wheel 20904188
20904197 109846 Wheel 20904189
20904398 109846 Wheel 20904189
10904146 109562 Truck
10904147 109562 Truck
10904148 109562 Axle 10904146
10904159 109562 Axle 10904146
10904167 109562 Wheel 10904148
10904177 109562 Wheel 10904148
10904185 109562 Wheel 10904159
10904325 109562 Wheel 10904159
10904188 109562 Axle 10904147
10904189 109562 Axle 10904147
10904195 109562 Wheel 10904188
10904196 109562 Wheel 10904188
10904197 109562 Wheel 10904189
10904398 109562 Wheel 10904189
Note : In Equipment Component Table,the hierarchy will be Truck-->Axle-->Wheel.So
1.the Parent_Eqpmnt_ID of Axle is Truck's Eqpmt_Cmpnt_id.
2.the Parent_Eqpmnt_ID of Wheel is Axle's Eqpmt_Cmpnt_id.
Now I want to write the store procedure which will take "PsngSmry_ID(Number)" as input and the o/p will be in the format :
Eqpmt_Cmpnt_id Eqpmt_id EqpmtCmpntName Parent_Eqpmnt_ID
20904146 109846 Truck
20904148 109846 Axle 20904146
20904167 109846 Wheel 20904148
20904177 109846 Wheel 20904148
20904159 109846 Axle 20904146
20904185 109846 Wheel 20904159
20904325 109846 Wheel 20904159
20904147 109846 Truck
20904188 109846 Axle 20904147
20904195 109846 Wheel 20904188
20904196 109846 Wheel 20904188
20904189 109846 Axle 20904147
20904197 109846 Wheel 20904189
20904398 109846 Wheel 20904189
10904146 109562 Truck
10904148 109562 Axle 10904146
10904167 109562 Wheel 10904148
10904177 109562 Wheel 10904148
10904159 109562 Axle 10904146
10904185 109562 Wheel 10904159
10904325 109562 Wheel 10904159
10904147 109562 Truck
10904188 109562 Axle 10904147
10904195 109562 Wheel 10904188
10904196 109562 Wheel 10904188
10904189 109562 Axle 10904147
10904197 109562 Wheel 10904189
10904398 109562 Wheel 10904189
**Please add these columns in the o/p **
1.EqpmtName and EqpmtType from Eqpmt table
2.VehicleName and Vehicle Type from Vehicle table
3.PsngSmryTime from PassingSummary table **
Can anyone tell me the solution?
Edited by: 865216 on Jun 22, 2011 2:14 AM
Hi,
I am new to this technology;But, just wanted to help you.
Please refer the code it might be atleast helpful for you.
But am facing PL/SQL: ORA-00933: error and unable to resolve it.could anyone please correct this code.
sorry if my code is totally wrong.
Thank you,
Rupa
create or replace procedure Equipment_proc
is
begin
DECLARE
TYPE EQP_record IS RECORD (
Vehicle_iD Vehicle.Vehicle_iD%TYPE,
Eqpmt_Cmpnt_id Equipment_Component.Eqpmt_Cmpnt_id%type,
EqpmtCmpntName Equipment_Component.EqpmtCmpntName%type,
Parent_Eqpmnt_ID Equipment_Component.Parent_Eqpmnt_ID%type,
Eqpmt_id Equipment.Eqpmt_id%type,
vehicleId NUMBER);
EQP_rec EQP_record;
CURSOR EQP_cursor IS
select a.Vehicle_iD,c.Eqpmt_Cmpnt_id,b.Eqpmt_id,c.EqpmtCmpntName,c.Parent_Eqpmnt_ID
from Vehicle a,Equipment b,Equipment_Component c
where a.Vehicle_iD=b.Vehicle_iD
and b.Eqpmt_id=c.Eqpmt_id
and a.vehicle_id=&EQP_rec.vehicleId;
BEGIN
OPEN EQP_cursor;
FETCH EQP_cursor INTO EQP_rec;
dbms_output.put_line(EQP_rec.Vehicle_iD,EQP_rec.Eqpmt_Cmpnt_id||','||EQP_rec.Eqpmt_id||','||EQP_rec.EqpmtCmpntName||','||EQP_rec.Parent_Eqpmnt_ID);
CLOSE EQP_cursor;
END;
END;
Similar Messages
-
How can i select some row from multiple row in the same group of data
I want to select some row from multiple row in the same group of data.
ColumnA
Column B
1 OK
1 NG
2 NG
2 NG
3 OK
3 OK
I want the row of group of
ColumnA if ColumnB contain even 'NG'
row , select only one row which Column B = 'NG'
the result i want =
ColumnA Column B
1 NG
2 NG
3 OK
Thank youThat's some awful explanation, but I think this is what you were driving at:
DECLARE @forumTable TABLE (a INT, b CHAR(2))
INSERT INTO @forumTable (a, b)
VALUES
(1, 'OK'),(1, 'NG'),
(2, 'NG'),(2, 'NG'),
(3, 'OK'),(3, 'OK')
SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
FROM @forumTable f
LEFT OUTER JOIN @forumTable f2
ON f.a = f2.a
AND f.b <> f2.b
GROUP BY f.a -
How to efficiently select random rows from a large table ?
Hello,
The following code will select 5 rows out of a random set of rows from the emp (employee) table
select *
from (
select ename, job
from emp
order by dbms_random.value()
where rownum <= 5my concern is that the inner select will cause a table scan in order to assign a random value to each row. This code when used against a large table can be a performance problem.
Is there an efficient way of selecting random rows from a table without having to do a table scan ? (I am new to Oracle, therefore it is possible that I am missing a very simple way to perform this task.)
thank you for your help,
John.
Edited by: 440bx on Jul 10, 2010 6:18 PMHave a look at the SAMPLE clause of the select statement. The number in parenthesis is a percentage of the table.
SQL> create table t as select * from dba_objects;
Table created.
SQL> explain plan for select * from t sample (1);
Explained.
SQL> @xp
PLAN_TABLE_OUTPUT
Plan hash value: 2767392432
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 725 | 70325 | 289 (1)| 00:00:04 |
| 1 | TABLE ACCESS SAMPLE| T | 725 | 70325 | 289 (1)| 00:00:04 |
8 rows selected. -
How can I select the workbook belongs to particular AWm
Hi,
How can i find oracle discoverer plus workbook is belongs to which awm/measure folder thru SQL.
I have 2 workbooks namely workbook1,workbook2 .These workbooks created based on 2 different Aw in 2 different users.
When you give the workbook name in a sql how to find this workbook belongs to this awm ??
I can able to find the workbook belongs to which user from BISM_OBJECTS but I couldn't locate the workbook belongs to which Awm/MeasureFolder name.
Any idea??
Thanks,
Natarajan.UHi
Unfortunately, just like with standard Discoverer which stores its workbooks as a binary object inside EUL5_DOCUMENTS, the same applied to the OLAP workbooks. You won't be able to read the inner workings I'm afraid.
Oracle do have a workbook dump utility for the standard Discoverer. You might want to ask Support if they have a similar tool for examining OLAP workbooks.
Best wishes
Michael -
How can i select the next column instead of next row when press enter key
I need to know how can i select the next column instead of next row when i press the enter key.By default ,when i press enter key the next row is selected and the column remain unchanged but I wants opposite that is the row should remain unchanged but column index will changed.
Thanks to all.Well, the right arrow key will already move you to the next column, so the easiest way to do this is to modify the InputMap to have the Enter key invoke the same Action as the right arrow key.
You can search the forum for my "Table Actions" (without the space) example that will show you how to do this. -
How can I select several emails from 3900 on my 5c and delete the rest easily
How can I select several emails from 3900 on my 5c and delete the rest easily
We'll I don't think there's a easy way to delete a lot of emails besides deleting all of them. To delete all of them click on inbox them edit then "mark all" then trash/delete. Other than that you will have to specifically deleted the ones you want to delete.
-
How can I select the existing worksheet while using OLE2 to open the template workboo
Source:
application:=ole2.create_obj('Excel.Application');
workbooks:=ole2.get_obj_property(application,'Workbooks');
args := ole2.create_arglist;
ole2.add_arg(args, 'c:\RptTemplate.xlt');
workbook:=ole2.invoke_obj(workbooks,'Open',args);
ole2.destroy_arglist(args);
worksheets:=ole2.get_obj_property(application,'Worksheets');
args := ole2.create_arglist;
ole2.add_arg(args, 'Sheet1');
worksheet :=ole2.invoke_obj(worksheets,'Select',args);
ole2.destroy_arglist(args);
Problem:
1. While executing the above code, error -305500 occurs after executing "worksheet := ole2.invoke_obj(worksheets','Select',args)". How can I select the sheet i wanted in the template ??
2. As I refer to the forms on-line document, it stated that the ole2 programmers documentation can provide all object types and methods that can be used with the OLE2. Does any link can provided to download the specified documentation ??The error is probably that your Worksheets variable is actually empty. Looking at your code I think the problem is that you try and get the value of the worksheets collection from the application then you should try and get it from the Workbooks object.
-
I'm trying to install itunes but can't complete installation as its trying to install onto F: drive. I don't have a F drive and I'm not given option of selecting the drive to install on. How can I select the drive that i want to install on?
Hi,
How do you connect the printer to the XP machine ? If USB, you need to make that machine as a Print server. Please try this:
http://techtips.salon.com/make-windows-computer-print-server-11914.html
Regards.
BH
**Click the KUDOS thumb up on the left to say 'Thanks'**
Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem. -
CS3 - Place Word document: How can I select the current preset?
Hi
In my Plugin I like to place a word document into a text frame. To do this I want select a defined preset before.
How can I do that?
How can I select the current preset for the placement (import)?
Thanks for the support
HansHi,
I had posted a similar query few days back to place excel file in text frame. And I found out that, it is not possible to specify formatting option for any of microsoft document when using Indesign SDK.
But we can do this by running script.
If you are able to specify the formatting option through script, write code to get script object & execute this script through Indesign SDK.
I was able to specify formatting option, sheet number, range etc through this.
Hope this helps.
Rajani -
How can i update the ADRT table REMARK field
How can i update the ADRT table REMARK field
by using only function modules or BAPI's not by direct update's
please help me
i need it urgentlyHi,
you can try this code:
SELECT SINGLE * FROM KNA1 WHERE KUNNR = wa_kunnr.
IF sy-subrc = 0.
CLEAR adrct.
SELECT SINGLE * FROM adrct WHERE addrnumber = kna1-adrnr.
IF sy-subrc = 0.
adrct-remark = wa_remark.
MODIFY adrct.
ENDIF.
ENDIF
best regards,
Thangesh -
How can I reference the last value in a column?
How can I reference the last value in a column? For example, today I want the value of A1 to appear in another cell. Tomorrow, I will add a row and want to reference A2, next day A3, and so forth.
Now I got it:
=OFFSET(A1,COUNT(A)-1,0) -
How can I view the size of a particular event in iPhoto '11?
How can I view the size of a particular event in iPhoto '11? The 'Get Info' option is not displaying the size of the event like it used to in iPhoto 8.
But the event does not really have a size - you can export the photos and make the size pretty much what you want - while it is in iPhoto it is an event
I guess that iPhoto could report the size of the original photos as imported - or the size of the modified photos if exported as JPEGs - or the size of the modified photos if exported with a maximum dimension of 1080 - but the event simply is photos and does not have a "size" until you export it
Obviously you want to know the size but the question was
what is your puprose for knowing the size?
WIth that information maybe there is a way to get you what you want
But the basic answer is simply that an event does not have a size - an event is a collection of photos and each photo has either two or three versions in the iPhoto library and each photo can be exported for outside use in several formats and at any size
LN -
How can I sum the values in a given column on sheet 1 i.e. A1:A50 based on the adjacent columns specific value i.e. B1:B50 = “Dinning Room” on sheet 2
For Example:
SHEET 1
A
B
$50
Dinning Room
$800
Dinning Room
$300
Kitchen
$1,000
Master Bedroom
$100
Dinning Room
SHEET 2
Display the total SUM amount of each Project based on Sheet 1
Project Name
Total Cost
Dinning Room
$950
Kitchen
$300Would be a good idea to open iWork Formulas and Functions User Guide and search for the description of the function named SUMIF
The Guide is available for every user thru the Help menu.
Yvan KOENIG (VALLAURIS, France) jeudi 19 mai 2011 17:32:42
Please :
Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
*How can we use the internal table in module pool programming? Clarify plz*
If we creating a screen using the table having four fields(for e.g.). The screen has the functions of display, modify, delete, save, exit etc for the fields. The front-end of the screen having I/O fields of the table using internal table. How can we declare the internal table in the screen?
HI,
Create one WA for your Internal table and then map it to your fields.
For Example,
Data : begin of wa,
name(10),
age type i,
end of wa.
data : it like table of wa with header line.
Then in screen create input fields with the name, age and ***.
Then the user entered values are stored in name age and ***.
then you can manipulate with that values using wa.
Thanks. -
How can i use the nested table in form 6i
how can i use the nested table in the form 6i
( i.e i want to insert record into the nestred table field ).
bye siddharth singhNested tables are not supported in Forms 6i, only simple object tables.
Maybe you are looking for
-
"Folio builder" update freezes InDesign CS6
Hello, The 'Folio builder' panel of InDesign kindly invited me to upgrade but unfortunalately, it now freezes InDesign as soon as I click on it. Thanks for any help, Patrick
-
NullPointerException by Servlets Calls
if I call a Servlet "http://www.myhost.ch:8080/testing/Hello", I receive the follwoing Errormessage: Error: 500 Location: /testing/Hello Internal Servlet Error:java.lang.NullPointerException at java.lang.ClassLoader.resolveClass(ClassLoader.java) Hel
-
Why is my ichat 5.0.3 video chat not working?
i've had my macbook pro for a week and the video chats been working perfectly fine. however, yesterday i tried to video chat, and it just said, this computer does not support video chats. the computer still recognizes the camera, and i can take pict
-
Although Wordperfect has the option for this size envelope, I cannot find a corresponding paper size for the printer. Therefore, when printed, the text location on the envelope is incorrect.
-
Problem with User Objects in Portal.
Hi Gurus, I am trying to get User Objects and do some operations like retrieve User information etc through a Plain Java Class. 1] Jar files that I am using are - sapj2eeclient.jar