How to create a view with "WITH CLAUSE"
HelloI have one query with 'BY' ARTICLE, I need to create a view of this query. But I get the error message like
ORA-32034: Unsupported sue clause.
Please help me...!
Please find below my request...!
WITH RANGE
AS (SELECT A.MASTERMACHINEID,
a.startdate,
a.enddate,
a.startdate - (1 / 3) + (lvl) * 1 / 3 SHIFT_ST_DT,
a.startdate + (lvl) * 1 / 3 AS SHIFT_END_DT,
a.quantity,
(LEAST ( enddate, TODATE) - GREATEST ( FROMDATE, startdate)) * 24 TOTAL_HRS,
(enddate - startdate) * 24 AVAIL,
todate,
fromdate
FROM OMP A,
(SELECT LEVEL lvl
FROM (SELECT MAX (enddate - startdate) AS diff FROM OMPWORKORDER)
CONNECT BY LEVEL <= (diff) * 3),
MASTER B
WHERE A.MASTERMACHINEID = B.MASTERMACHINEID
AND lvl / 3 <=(enddate - startdate) + 1
ORDER BY SHIFT_ST_DT)
SELECT shift_date,
shift_num,
shift_hrs,
DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME),
8 - DECODE (SIGN (SHUT_DWN_TIME), -1, 0, SHUT_DWN_TIME) shift_avail_hrs,
qty,
total_qty
FROM (SELECT TRUNC (SHIFT_ST_DT) shift_date,
ROW_NUMBER () OVER (PARTITION BY TRUNC (SHIFT_ST_DT) ORDER BY SHIFT_ST_DT) shift_num,
8 shift_hrs,
(LEAST ( SHIFT_END_DT, TODATE) - GREATEST ( FROMDATE, SHIFT_ST_DT)) * 24
SHUT_DWN_TIME,
quantity / (avail - TOTAL_HRS) qty,
round(((SHIFT_END_DT - SHIFT_ST_DT) * 24 - (LEAST (SHIFT_END_DT, TODATE) - GREATEST (FROMDATE, SHIFT_ST_DT)) * 24) * QuantiTY / (AVAIL - TOTAL_HRS),2)
TOTAL_QTY
FROM RANGE A );
ConcerningKPR
Published by: BluShadow on March 17, 2011 09:48
addition of {noformat}
{noformat} tags for readability
Try to create the view on the next request, if it helps you:
SELECT shift_date,
shift_num,
shift_hrs,
decode(SIGN(shut_dwn_time), -1, 0, shut_dwn_time),
8 -decode(SIGN(shut_dwn_time), -1, 0, shut_dwn_time) shift_avail_hrs,
qty,
total_qty
FROM
(
SELECT TRUNC(shift_st_dt) shift_date,
row_number() over(PARTITION BY TRUNC(shift_st_dt)
ORDER BY shift_st_dt) shift_num,
8 shift_hrs,
(least(shift_end_dt, todate) -greatest(fromdate, shift_st_dt)) *24 shut_dwn_time,
quantity /(avail -total_hrs) qty,
ROUND(((shift_end_dt -shift_st_dt) *24 -(least(shift_end_dt, todate) -greatest(fromdate, shift_st_dt)) *24) *quantity /(avail -total_hrs), 2) total_qty
FROM
(
SELECT a.mastermachineid,
a.startdate,
a.enddate,
a.startdate -(1 / 3) +(lvl) *1 / 3 shift_st_dt,
a.startdate +(lvl) *1 / 3 AS
shift_end_dt,
a.quantity,
(least(enddate, todate) -greatest(fromdate, startdate)) *24 total_hrs,
(enddate -startdate) *24 avail,
todate,
fromdate
FROM omp a,
(SELECT LEVEL lvl
FROM
(SELECT MAX(enddate -startdate) AS
diff
FROM ompworkorder)
CONNECT BY LEVEL <=(diff) *3),
master b
WHERE a.mastermachineid = b.mastermachineid
AND lvl / 3 <=(enddate -startdate) + 1
ORDER BY shift_st_dt
) a
)
;
Kind regards
Dipali.l
Tags: Database
Similar Questions
-
How to create a view with columns from multiple lines
I posted this in the SQL/PSL forum, but I hope that experts from the database in this group can give me ideas also, the necessity is also BI reports.
I have a table, for example, project_milestones, that has these columns in order:
PROJ_ID, milestone_name, actual_end_date
with data:
PROJ_ID, milestone_name, actual_end_date
===== ================ ==============
1001, key approval, 2009-10-02
1001, final synopsis, 2009-10-07
1001, approved final Protocol, 2009-10-15
1001, FPFV, 2010-01-10
1001, LPFV, 2010-03-12
...
1002, key approval, 2008-12-02
1002, final synopsis, 2009-01-07
1002, approved final Protocol, 2009-01-12
1002, FPFV, 2009-03-30
1002, LPFV, 2009-10-04
...
There are about 10 steps in each project.
I need to create a view for dish these data at the project level, looks like this:
PROJ_ID, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days...
How can I do this?
Thank youuser9175541 wrote:
I posted this in the SQL/PSL forum, but I hope that experts from the database in this group can give me ideas also, the necessity is also BI reports.I have a table, for example, project_milestones, that has these columns in order:
PROJ_ID, milestone_name, actual_end_date
with data:
PROJ_ID, milestone_name, actual_end_date
===== ================ ==============
1001, key approval, 2009-10-02
1001, final synopsis, 2009-10-07
1001, approved final Protocol, 2009-10-15
1001, FPFV, 2010-01-10
1001, LPFV, 2010-03-12
...
1002, key approval, 2008-12-02
1002, final synopsis, 2009-01-07
1002, approved final Protocol, 2009-01-12
1002, FPFV, 2009-03-30
1002, LPFV, 2009-10-04
...
There are about 10 steps in each project.
I need to create a view for dish these data at the project level, looks like this:PROJ_ID, key_element_date, final_synopsis_date, final_protocol_approved_date, FPFV_date, LPFV_date, key_element_to_final_synopsis_days, final_synopsis_final_protocol_days...
How can I do this?
Thank you
Create a PivotTable and put "milestone_name" in the columns, under the labels section.
Put 'actual_end_date' in the section of measures and to change the rule of the aggregation of 'Max '.
The rest of the attributes keep in the lines section. -
How to create Table View with even a column name but another Table?
Hi all
I have the problem to create a tableview with the same column name, but in the other table.
Table I: -.
Table - PAC051MPROFORMA
Column - MNR, visitid
Table - PAC051TPROFORMA
Column - MNR, visitid
Table - PAC052MTRANSBILL
Column - MNR, visitid
Then, I want to create a table for this table. It comes to my SQL
Pacviewproforma CREATE VIEW (MNR, visitid, MNR, visitid, MNR, visitid)
Like some PAC051MPROFORMA.mrn, PAC051MPROFORMA.visitid, PAC051TPROFORMA.mrn, PAC051TPROFORMA.visitid, PAC052MTRANSBILL.mrn, PAC052MTRANSBILL.visitid
where
* (a.PAC051MPROFORMA.mrn = PAC051TPROFORMA.mrn) *.
and
* (a.PAC051TPROFORMA.mrn = PAC052TRANSBILL.mrn) *.
SQL return this error ORA-00957 =: duplicate column name
Can I change this SQL for
Pacviewproforma CREATE VIEW (MNR, visitid)
Like some PAC051MPROFORMA.mrn, PAC051MPROFORMA.visitid, PAC051TPROFORMA.mrn, PAC051TPROFORMA.visitid, PAC052MTRANSBILL.mrn, PAC052MTRANSBILL.visitid
where
* (a.PAC051MPROFORMA.mrn = PAC051TPROFORMA.mrn) *.
and
* (a.PAC051TPROFORMA.mrn = PAC052TRANSBILL.mrn) *.
This time this error return = ORA-01730: number of column names specified invalid
What should I do?
Thank you...Hello
SQL> CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid) 2 As Select 3 PAC051MPROFORMA.mrn, 4 PAC051MPROFORMA.visitid, 5 PAC051TPROFORMA.mrn, 6 PAC051TPROFORMA.visitid, 7 PAC052MTRANSBILL.mrn, 8 PAC052MTRANSBILL.visitid 9 from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL 10 where 11 (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn) 12 and 13 (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn); CREATE VIEW pacviewproforma (mrn,visitid,mrn,visitid,mrn,visitid) * ERROR at line 1: ORA-00957: duplicate column name
Please give different names to each column.
Something like that...
SQL> CREATE OR REPLACE VIEW pacviewproforma (MPROFORMA_mrn,MPROFORMA_visitid,TPROFORMA_mrn,TPROFORMA _visitid,MTRANSBILL_mrn,MTRANSBILL_visitid) 2 As Select 3 PAC051MPROFORMA.mrn, 4 PAC051MPROFORMA.visitid, 5 PAC051TPROFORMA.mrn, 6 PAC051TPROFORMA.visitid, 7 PAC052MTRANSBILL.mrn, 8 PAC052MTRANSBILL.visitid 9 from PAC051MPROFORMA,PAC051TPROFORMA,PAC052MTRANSBILL 10 where 11 (PAC051MPROFORMA.mrn=PAC051TPROFORMA.mrn) 12 and 13 (PAC051TPROFORMA.mrn=PAC052MTRANSBILL.mrn); View created. SQL> DESC pacviewproforma; Name Null? Type ----------------------------------------- -------- ---------------------------- MPROFORMA_MRN NUMBER MPROFORMA_VISITID NUMBER TPROFORMA_MRN NUMBER TPROFORMA_VISITID NUMBER MTRANSBILL_MRN NUMBER MTRANSBILL_VISITID NUMBER
ORA-01730: number of column names specified invalid
The list of the nmae column you specified for the CREATE VIEW must correspond with the list of SELECTION in the view.
Twinkle
-
5.6.1 pages: How to create a table with more than 999 lines?
5.6.1 pages: How to create a table with more than 999 lines?
The table on Pages v5.6.1 line selector is limited 3-digit, as it is in Pages ' 09 v4.3. Either use LibreOffice Writer, who does not have any constraint line on processing tables 3-digit, or any application spreadsheet for top 3-digit row needs.
-
How to create Hlp files with labwindows 9.0
Hello
I used to create the dll with Labwindows 8.5 and use them with TestStand... The advantage is that with the help file, I can add information to the Fp file and loading the DLL with TestStand, the "?" button to open the help file...
But the problem is that I can't find help with Labwindows 9.0 generation...
Does anyone know how to create file hlp with Labwindows 9.0?
The procedure with Labwindows 8.5 has been:
Modification of the PS file, then generate the Option-> windows help
Thank you very much
Ronan
-
How to create an app with space name?
Hi all
How to create an application with the space, for example "Hello Word" name When I run my Simulator, I got ' Hello$ 20World "instead. I use the plugin for eclipse for development. I can see the Application descriptor for my application, and it shows the thin space. I tried to change the Blackberry project properties tab generate file output name, but it doesn't help in any way. Please advise...
Goto Blackberry project properties
Click the general tab
Write in title = "Hello World".
and you can see your title of the modified project
I hope that you ask for it only!
-
How to create a form with a submit in CC button animate using Actionscript 3
How to create a form with a submit in CC button animate using Actionscript 3. The file will first be a SWF but will also have the flexibility to export as HTML5
I've searched high and low for an example of code for this entry.
Can someone help me please?
Thank you
You can use the same graphic assets of basis for two projects, but the coding will be different for everyone. You must work on the project of a code at a time.
-
How to create dummy data with 1 TB
Hi Expert,
May I know how to create dummy data with 1 TB to test performance. ?
Respect of
Liang
what columns you want to include? Basically, you can generate as many lines as you like to connect by queries - something like:
create the table big_t
as
with
generator1 like)
Select rownum id
of the double
connect by level<=>=>
)
,
generator2 as)
Select lpad ('* ', 1000,' *') col1
of the double
connect by level<=>=>
)
Select g1.id
g2.col1
of generator1 g1
generator2 g2
;
Of course, it is not 1 TB, but you can change the number of levels. Who said: I think you need to find a sensitive table first structure.
-
Hello
How to create a button with rollover that appears in a different place than the button when you move by using only the Muse (reversal may be a different shape and color of the button). I managed to do it using Photoshop and the separate layers and import it, but it is not a good solution. All suggestions will be welcome.
Thank you
You can try to use the widget of the Composition of the ToolTip. In this way, the trigger area is isolated and a "State of reversal" can be placed anywhere on the screen (compared to the trigger).
- Remove the two triggers additional default
- Set to display the targets on working capital
- Select hide all initially.
-
How to create a DVD with Media Encoder? Thank you!
How to create a DVD with Media Encoder? Thank you!
Export to mpeg2-DVD and use a design program like still to create DVD compatible files to burn to DVD.
-
How to create a window with its own window border other than the local system window border?
How to create a window with its own window border other than the local system window border?
For example, a border: a black line with a width of 1, then a transparent line with a width of 5. Inside, it's the content pane.
In JavaSE, there seems to be for the JFrame paintComponent() method to realize the effect.
I can't see what you're trying to do now: it's a little trickier. You need stage.initStyle (StageStyle.TRANSPARENT), and I think you have to imitate the transparent part of the border by the presence of a second vessel inside the root container, properly positioned.
Something like:
import javafx.application.Application; import javafx.application.Platform; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.stage.StageStyle; public class CustomBorderExample extends Application { @Override public void start(Stage primaryStage) { AnchorPane root = new AnchorPane(); root.setStyle("-fx-border-color: black; -fx-border-width: 1px; "); StackPane mainContainer = new StackPane(); AnchorPane.setTopAnchor(mainContainer, 5.0); AnchorPane.setLeftAnchor(mainContainer, 5.0); AnchorPane.setRightAnchor(mainContainer, 5.0); AnchorPane.setBottomAnchor(mainContainer, 5.0); mainContainer.setStyle("-fx-background-color: aliceblue;"); root.getChildren().add(mainContainer); primaryStage.initStyle(StageStyle.TRANSPARENT); final Button closeButton = new Button("Close"); mainContainer.getChildren().add(closeButton); closeButton.setOnAction(new EventHandler
() { @Override public void handle(ActionEvent event) { Platform.exit(); } }); primaryStage.setScene(new Scene(root, 300, 200, Color.TRANSPARENT)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } -
How to create RAID 5 with 6 disks?
I'm new to vmware. My machine is currently running ESXi 4.1 but the RAID set up gives me no more disk space I was advice to remake the structure of the disc physically to have all 6 disks in RAID 5 and then reinstall ESXi. I'm doing, but I need a direction how to create RAID 5 with 6 disks. Can someone please help with this?
Thank you
SD
Assuming you are using the integrated Smart Array 6i controller it should without a problem. If you can get into the BIOS of conreollers, you can also boot from Smartstart CD and use the ACU (Array Configuration Utility). The ACU has the advantage that you can split the RAID in several logical drives. I usually create a small logical volume (~ 10GB) for the installation of the hypervisor (ESXi) and another large logical volume to the VMFS data store.
André
PS: When you respond by e-mail, please do not understand the original message.
-
How to create a table with two unique columns
How to create a table with two unique columns. I use the following syntax below and I get the error message such unique or primary key already exists.
create the table COPQ_WORKCELL_GOAL
(
Type_id varchar2 (4) NOT NULL UNIQUE,
Tyle_Location varchar2 (30) NOT NULL UNIQUE,
Type_Description varchar2 (20).
KEY elementary SCHOOL (Type_id)
);Use 1 or the other column type_id;
create table COPQ_WORKCELL_GOAL ( Type_id varchar2(4), Tyle_Location varchar2(30) NOT NULL UNIQUE, Type_Description varchar2(20), PRIMARY KEY (Type_id) ); Table created drop table COPQ_WORKCELL_GOAL; Table dropped create table COPQ_WORKCELL_GOAL ( Type_id varchar2(4) primary key, Tyle_Location varchar2(30) NOT NULL UNIQUE, Type_Description varchar2(20) ); Table created
-
How to create a Viewer without buying the image? I want to be able to save the images I'm looking a subject without purchase or download.
After talking to the Customer Service, I now get it. Thank you.
That is to say: down arrow recorded a watermark image in the gallery without you buy. You can download an overview lores on your desktop for motorhomes with this same arrow, but it is unfortunately a watermark (unlike the DPC). You can also copy and send a link to the Gallery clients to review before you buy.
-
Hi all
11.2.0.1
I have tables EMP and DEP, and their structures are the ff:
DEP (depno, depname)
EMP (emp_id, depno)
I want to create a view EMP_VIEW (emp_id, status).
The status value is "Active" (if depno exists in DEP) or 'Inactive' (if depno is null or not depno corresponding to the DEP).
How to create this view?
Thank you very much
zxyCheck this box
SQL> insert into emp(empno,ename) values (1234,'test'); 1 row created. SQL> commit; Commit complete. SQL> create or replace view emp_view as select e.empno, nvl2( d.deptno,'Active','Inactive') Status from emp e left outer join dept d on e.deptno=d.deptno; View created. SQL> select * from emp_view; EMPNO STATUS ---------- -------- 7369 Active 7499 Active 7521 Active 7566 Active 7654 Active 7698 Active 7782 Active 7788 Active 7839 Active 7844 Active 7876 Active 7900 Active 7902 Active 7934 Active 1234 Inactive 15 rows selected.
Maybe you are looking for
-
Satellite Pro 4600 - Boot CD problem
Hi people, Remember that Satellite Pro I mentioned many months ago? The one with the flashing orange?Well, I changed the MoBo Ant that he finally turned on. But a problem arised... it does not read CD. Whenever I insert a system disk, it is said: "in
-
A200: Need charger Specifications
Good day peoples. Lost my charger... Can someone send to me the output voltage and amps for one so I can get a generic to my local electronics store? Thanks heaps...
-
Problems of Windows 7 with Mabinogi
Here's my problem. I tried to install Mabinogi after my computer has been erased, and then upgraded to windows 7 from windows Xp. I had no issues when he was under windows Xp, but I have a problem trying to boot Windows 7. I get a message from the ga
-
Why my administrator stood account disappear?
I turned on my PC and where my name is usually to sign in with my password went along with my administrator rights. I lost programs, images and the basic access to my own PC. No, I have to open a session as a quest.
-
Hi I just installed a comfort 5000 wireless keyboard microsoft and mouse, f4 does not behave like f4 can help you please. your bil