How to create a view?
Hi all11.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
zxy
Check 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.
Tags: Database
Similar Questions
-
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.
-
How to create relational views based on an xmltype table which included sev
Hello
I'm using oracle 11.2.0.1.0.
How to create a relational view based on a table xmltype including the content of the .xml files several different?
Thank you.
For examle:
SQL > SELECT OBJECT_VALUE FROM document;
Published by: cow on January 6, 2011 19:57In general, you can use XMLTable to create these views...
You will need to create a view for each collection
The notice will contain the data of all documents...
-
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 a view with "WITH CLAUSE"
Hello
I 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...!
ConcerningWITH 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 );
KPR
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 -
How to create a view of many-to-many?
Say that I a student, course and StudentCourses of entity objects and their objects in view.
What other components do I need to create a workflow that allows a student to courses list/add/remove what (s) he takes?
Below I list the objects that I know. Could you please add to it? Thank you very much.
1-entity objects: student, course, StudentCourses.
2 display items:
+ StudentView
+ GolfVoir
+ StudentCoursesView:
SQL: select s.Name, c.Name StudentCourse sc, join student s class c where sc. StudentID = s.StudentId and sc. CourseId = c.CourseID
If I add/change/remove info in this point of view, will be the sight of the persistent changes in all necessary tables?
Module 3-application of the instances of all objects of view 3.
4-task flow:
+ Course LOV
+ Student LOV
+ ...
Published by: cody on February 4, 2011 09:08Hey Cody,.
I think you are looking for a relationship between students master/detail / StudentCourses.
Display object / see the installation link
- You have your items two view, student and student courses.
- Create a 1 to many association between entities of your student and StudentCourses.
- Create a view based on this association link.
- Put these two display objects in the data model of the Module of your Application.
LOV
- You have your view object, racing View
- Go to your StudentCourses discovered the object, and select the attribute on which you want to place the LOV. It should be an option of LOV below where you can attach the view golfVoir (VO) like a LOV object.
JSP
- Pull the top of your workflow adfc.config file.
- Drag a view of the workflow. Double-click the view to create a JSP page.
- Drag an expandable Panel on page layout for an overview.
- Your data controls, drag the StudentView to the superior facet (you may have to refresh to get your newly created data controls). Be sure to include the navigation controls/buttons.
- Your data controls, drag the StudentCourses to the Central facet.
- Surround with a collection of panels and put a toolbar in its side of the toolbar.
- Your data controls, drag a StudentCourses operation CreateInsert operation in your toolbar
- Your data controls, drag operations StudentCourses delete operation in your toolbar
-
How to create the view in OBIEE
I have "table 1" with columns, Attr1, Attr2, action 1, measure 2.I need to create the view in the table repository Attr1, Measure1 and new attribute with values like a flag 3 'Y' in it. ". What will be the SQL code of the new view. Please provide the exact syntax for the view.
Thanks in advanceHi Hsekar,
You are right, it is called a SELECT type.
Regarding your second question I don't know what you mean. You are using an SQL Select statement in this area. The Alias of the columns must match the columns will place you in the RPD exactly. But in this process, you create a physical view DB object, so there is not need to name it. You just create the select statement that you would use to create a view and OBIEE refers to the statement.
If you have found the correct answer please give points!
Best regards
-Joe
-
How to create a view in the DB table for some servers
Hello
We need create a country table which will contain data for countries.
I want to create it in such a way that it will be common for all servers - but as a point of view. not the real table, only the data and views do not change.
How can I do?
Thanks in advanceAre you sure you want to say 'tablespace '? A tablespace is a collection of data files. It has nothing to do with the privileges of the object, object namespaces, etc. I'm guessing that you mean that you have two schemas, OBITUARIESCS and ADVERTISEMENTCS. A schema is a collection of objects of database belonged to a particular user. A single table can exist in spaces of multiple tables (assuming it is partitioned). Different schemas can have an infinite number of tables with the same name in the same table. The database schema is the namespace for objects such as tables.
Assuming that you have two schemas in your database, you can create a table of COUNTRIES in the OBITUARIESCS schema. You can then grant SELECT access on the table to another user, ADVERTISEMENTCS, i.e.
GRANT SELECT ON country TO advertisementcs
You can then ask questions (but not change) the COUNTRY code of the property of ADVERTISEMENTCS table
SELECT * FROM advertisementcs.country
If you want to be able to remove the prefix in the schema, you can create a synonym. In the ADVERTISEMENTCS schema
CREATE SYNONYM country FOR advertisementcs.country
and then when the code of the property of ADVERTISEMENTCS wants to query the countries table, it can just
SELECT * FROM country
Justin
-
How to create the View object with several editable entity objects
I want the two entities in the view object to support the creation of new lines, but when I give create insert that it allows to insert only on the parent and not the child. I found this link
http://docs.Oracle.com/CD/E21043_01/Web.1111/b31974/bcadvvo.htm#CEGCAJCI which replaces the outgoing class. but I would like to do declarative. Is there another way to do it?
I use Jdeveloper 11g 2 version.
Thanks in advance,
RakeshHello
There is a checkbox in the tab "Updatable" entity objects, mark it checked and look in your vo
Then, you can create the ViewObject also editable attribute
Make sure that the Association is here.Rognard
-
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
-
How to create the View object dynamically
Hello
I HAV a requirement to create a dynamic display object.
can someone help me please.
Thank you
NaN :)Hi Nani,
Have you tried the given final code?
Gerard
-
How to create the view at 360 degrees of an image?
pleaseeee help me with a tutorial or examples, my knowledge of the codes is minimal
Here's another plugin with buttons.
-
How to create a ViewObject attribute where value to get database query
Hi Expert,
I have a case for the value of database query. How to create the view additional attribute object where the value get database query?
parameter binding of attributeId object in view I can do this in ADF with JDeveloper 11.1.1.6.
Thank you
Kind regards
Wade W
My problem is solved, maybe it's a bug in the JDeveloper 11.1.1.6.0
I've got error (oracle.jbo.expr.JIEvalException) Houston-25077: name amount not found in the given object: oracle.jbo.server.ViewRowSetImpl@8690e3.
When I develop by tab Overview (presentation of the business components). It is so strange, because I have an another transient viewAttribute that refer to another object in view and not get an error message like this before I create viewAttribute HeaderAmount.
Maybe its ridiculous appearance, but when I go to View (lineVO.xml) object and tab to the source xml file, I have edited here. like to write
<>
Name = "HeaderAmount".
IsUpdateable = "false".
IsSelected = "false".
IsPersistent = "false".
PrecisionRule = 'true '.
Type = "Oracle.jbo.domain.Number"
ColumnType = 'NUMBER '.
AliasName = 'VIEW_ATTR. '
SQLType = 'DIGITAL' >
<>
Value = "ActivityHeaderId" / >
and make sure this xml file are:
<>
Name = "ActHeaderView1VO".
ViewLink = 'model. ActHeaderLineLink ".
Type = "Oracle.jbo.Row"
Reversed = 'true '.
IsUpdateable = "false" / >
When I try to re-run the application model and it's work...
Thanks for your help. really appreciate
-
Creating a view in a new schema
I use the Oracle SQL Developer 10g client. I want to know how to create a view in the diagram. I have a schema that has all of my table and the views. I want to create a view in a pattern that has no data. It is only to look at a goal only of the view I want to create.
Thank you
Kevin
As I said.
Connection to the schema where the table exists
Grant select on
to Connect to the new schema
Create view
select * from . ;. What you want?
-
How to create criteria to display named with the EXISTS operator?
I use JDeveloper 11.1.1.2.0. In Guide of Fusion Developer's for Oracle Application Development Framework in the section "How to Create Named views criteria declarative 5.11.1" I found figure '5-41 Edit View dialog with a view specific criteria criteria", which used the EXISTS operator. But I can't repeat this example in my project, coz I can't find operator EXISTS in the list of choices. ?:|
link to the image: [http://img23.imageshack.us/img23/1708/jdevexists.jpg]Vitaly,
I checked this in 11.1.1.3, YMMV Yes.
The operand EXISTS is fine for me. According to the document that you referenced (at least in 11.1.1.3 docs), you can use the operand EXISTS when the "attribute", you select another VO referenced via a link display:
The list shows only the operators that are appropriate for the selected
object attribute or view. In the case of a selection of objects in view, it is
operator applies a standard of display you set (or reference) as a
operandJohn
Who should do about it. If this isn't the case, you're close enough.
Will be
Published by: LovettWB on February 5, 2011 13:49
Maybe you are looking for
-
iPhone 6 my screen is all black with white lightning
The screen is all black with white flashes when I turn it on. Is it a broken screen / digitizer or would it be a hardware problem? This also happened to me a months I did a factory reset. The screen flickered a few minutes after, but was wrong after
-
Ask about upgrading the hard drive for X230T
Hello world My post here so apologies if an error. I have a model x230T 3434-CTO (fairly old ) It has 180 GB SSD drive, which is quite less and I intend to improve it with a larger capacity SSD. I researched and found that my options are (1) normal S
-
Crash Windows Explorer in Vista
My Windows Explorer process (Vista OS) crashed and when I reload the powers of the PC upward, at Windows startup and then Explorer says that its defective, puts in place a dialogue box saying it is looking for a solution, report the problem to Micros
-
What-do-i-do-If-My-Upgrade-isn't-Successful
What-do-i-do-If-My-Upgrade-isn't-Successful
-
SSLVPN package SSL-VPN-Client (seq:1): installed error: others
"Try to install the package anyconnect-victory - 2.5.2019 - k9.pkg on a Cisco 1811 running c181x-advipservicesk9 - mz.124 - 22.T5.bin router, when I run the command in config mode" webvpn install flash: anyconnect svc - win - 2.5.2019 - k9.pkg ' I ge