Create a view of RDF in Oracle 12 c of tables in an Oracle 11 g Server
Hello!
I have a relational database in Oracle 11 g server, but I need to create the view of RDF model in Oracle 12 c in the base tables.
I created a database connection to connect to the server of Oracle 11 g Oracle 12 c, using the statement:
CREATE DATABASE LINK myDBLink
CONNECT to user_test
IDENTIFIED BY test123
WITH THE HELP OF '(DESCRIPTION=)
(ADDRESS = (PROTOCOL = TCP)(HOST=192.0.56.158) (PORT = 1521))
(CONNECT_DATA = (SID = orcl)))';
The works of the SELECT statement:
Select * from EMP@myDBLink;
I also created a SYNONYM:
CREATE the SYNONYM MY_EMP FOR EMP@myDBLink;
The SELECT statement with the synonym also works:
Select * from EMP@MY_EMP;
Well, to create the view of RDF, I use a sem_apis.create_rdfview_model function. Now, I wrote the statement of the following two ways:
BEGIN
() sem_apis.create_rdfview_model
Model_name = > "test_linked"
tables = > SYS. ODCIVarchar2List ('MY_EMP', 'MY_DEPT'),
prefix = > ' http://GrDF/ ',
Options = > ' COMPLIANCE = you
);
END;
BEGIN
() sem_apis.create_rdfview_model
Model_name = > "test_linked"
tables = > SYS. ODCIVarchar2List('EMP@myDBLink','DEPT@myDBLink'),
prefix = > ' http://GrDF/ ',
Options = > ' COMPLIANCE = you
);
END;
And I get the following error:
ORA-13199: fetchTabIDList: not found in tables:
ORA-06512: at the 'MDSYS. SDO_RDF_INTERNAL', line 14308
ORA-06512: at the 'MDSYS. SDO_RDF', line 3616
ORA-06512: at the 'MDSYS. RDF_APIS', line 1253
ORA-06512: at line 2
I use examples of book of the Oracle tables.
Thank you
Yenier
Yenier,
Could you please try creating a view rather than a synonym? Here is an example:
SQL >-create dblink
SQL > create public database link
2 mylink
3 connect to
Scott 4
5 identified by
6 Tiger
using a 7 '
Database link created. SQL > SQL >-create view local using queries involving remote database objects SQL > create view dblink_scott_EMP in select * from EMP@mylink; Created view. SQL > SQL >-add the primary key (help requests on Direct mapping according to models RDFView to have shorter SubjectMaps) SQL > alter view dblink_scott_EMP add constraint pk_EMPNO primary key (EMPNO) disable; Altered view. SQL > SQL > - create model DM - based RDFview SQL > exec sem_apis.create_rdfview_model ('dblink_test_rv', sys.odcivarchar2list ('DBLINK_SCOTT_EMP'), "http://dm/"); PL/SQL procedure successfully completed. SQL > Thank you -Smiled.
Tags: Database
Similar Questions
-
Hi all
I am beginner in Oracle.
I have a two-column table that I use to create a view documents/statement once it meets the qualification.
The table has fields. 1 number and 2. Group. If there is more than 3 records found on this table with the same NUMBER and the GROUP he should create this table view.
Thank you
Pramod Devkate
The training is therefore two lines for a ticket and the agent. When the third row is added, create a line in the summary table. Later a fourth line is added to the table of training for this ticket and the agent, but we do not update the line in the summary table. We only touch the summary table when the third row is added to the training table, then it is only updated by the application. Very well
INSERT INTO summary (ticket, agent, total_travel, total_mtts)
Select ticket agent, sum (travel), sum (mtts)
training
where (ticket, agent) not in
(select the ticket agent summary)
Group ticket, agent
having count (*) > 2.
This inserts in the table only notes and agent ID that do not exist already.
-
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?
-
write a view with function in oracle
Hi all
I have a table named border, contains the borders of certain countries.
and then I did notice, for symmetric data, which means that if I have a folder {ch, OF} I {, ch}.
so I want another opinion, preferably with the help of functions, to show me that these results, the first view must be used, not the main table, to create this view.
en, 1
pl, 1
UK, 2
read, 2
read, 3
This means between these countries, we have these quantity of bordes, but we just want to see these up to 3 borders, not more.
Thanks for your reply.
IM using oracle 10 g and linux ubuntu 12.
First of all, I have a table illustrating the countries
{code}
-File created - Sunday-November-24-2013
--------------------------------------------------------
--------------------------------------------------------
-The DOF for Table BORDERS
--------------------------------------------------------
CREATE TABLE 'borders' ('Country1' CHAR (2), 'countries2"TANK (2), the NUMBER of 'LENGTH')
INSERTION of REM in borders
TOGETHER TO DEFINE
Insert into borders (countries1, countries2, LENGTH) values ('from', 'fr', 381);
Insert into borders (countries1, countries2, LENGTH) values ('from', 'ch', 494);
Insert into borders (countries1, countries2, LENGTH) values ('from', 'pl', 148);
Insert in borders (countries1, countries2, LENGTH) values ('ch', 'fr', 608);
Insert in borders (countries1, countries2, LENGTH) values ('ch', 'it', 318);
Insert into borders (countries1, countries2, LENGTH) values ("ch", "li", 240);
Insert into borders (countries1, countries2, LENGTH) values ('he', 'if', 306);
Insert into borders (countries1, countries2, LENGTH) values ('he', 'DM', 584);
Insert into borders (countries1, countries2, LENGTH) values ('en', 'read', 549);
Insert into borders (countries1, countries2, LENGTH) values ('en', 'of', 1000);
Insert into borders (countries1, countries2, LENGTH) values ('pl', 'ru', 628);
Insert in borders (countries1, countries2, LENGTH) values ('pl', 'sk', 126);
Insert into borders (countries1, countries2, LENGTH) values ('UK', 'au', 1800);
{code}
and then I have a symmetrical data view:
{code}
SELECT B.COUNTRY1, B.COUNTRY2
BORDERS B
UNION
SELECT B.COUNTRY2, B.COUNTRY1
BORDERS B
{code}
Of course you can do it in a function. But why write a function where possible in SQL using the features of Oracle wrote to us ;-)
'min way' is the key here sentence. You said... for example, we do not want {en, 3, 1000}
Is it because that {en, a, 2} is already covering en-> of?
In, this case may be something like this... I am sure that other members may provide the most effective solution.
But please review these suggested solutions build further and learn SQL/capabilities in Oracle. After all, it's that you should maintain and build on this code. Play with this code and see what makes each step. You will be able to solve the problem that you encounter in yourself. Basically, it is the main objective of these forums.
> col A30 path format
> with t as)
Select the Country1, countries2, lvl level length, SYS_CONNECT_BY_PATH (countries2, ' /') 'Path' of borders
Start by Country1 = "of" connect by nocycle Country1 = countries2 prior)
t2 as)
Select t.*, min (lvl) on Pmin (partition by Country1, countries2) t where lvl<>
Select * from t2 where Pmin = lvl
Country1 countries2 LVL PMIN path LENGTH
-------- -------- ---------- ---------- ------------------------------ ----------
ch fr 2 608 /ch/fr 2
ch it 2 318 /ch/it 2
ch li 2 240 /ch/li 2
de ch 1 494 /ch 1
de fr 1 381 /fr 1
de pl 1 148 /pl 1
fr de 2 1000 /fr/de 2
fr lu 2 549 /fr/lu 2
it si 3 306 /ch/it/si 3
it sm 3 584 /ch/it/sm 3
pl ru 2 628 /pl/ru 2
pl sk 2 126 /pl/sk 2
ru ua 3 1800 /pl/ru/ua 3
13 selected lines
Elapsed time: 00:00:00.018
I hope this helps.
VR,
Sudhakar
-
Hello
I get the same error, that so many times posted in this forum. But the case of the mine is little different from the others. I use JDeveloper 12 c
I have download several files and commit in DB a. Files and downloaded a list here. I am facing problem when Blob respective data in connection parameter. I am trying to download the file doc.txt which contained karima.
Code snippet:
private list < UploadedFile > uploadedFile.
List of files < UploadedFile > = this.getUploadedFile ();
for (int i = 0; i < files.size (); i ++) {}
AttributeBinding atrBlobDocContent = (AttributeBinding) bindings.getControlBinding ("DocContent");
atrBlobDocContent.setInputValue (files.get (i)); Error happen here tried 1
Below I tried 2
blobFile = FileOperations.writeToBlobDomain (files.get (i));
atrBlobDocContent.setInputValue (blobFile);
How can I set blob value in list in link atrBlobDocContent.
See detail below code
Bean class public class FolderUploadBean {}
public BindingContainer {} getBindings()
back...
Return BindingContext.getCurrent () .getCurrentBindingsEntry ();
}
BindingContainer links = getBindings();
private list < UploadedFile > uploadedFile.
private list < String > fileName;
Private BlobDomain blobFile;
{} public void setBlobFile (BlobDomain blobFile)
this.blobFile = blobFile;
}
public BlobDomain getBlobFile() {}
Return blobFile;
}
public FolderUploadBean() {}
}
{} public void setUploadedFile (list < UploadedFile > uploadedFile)
this.uploadedFile = uploadedFile;
}
public list < UploadedFile > getUploadedFile() {}
uploadedFile return;
}
public String saveFiles() {}
List of files < UploadedFile > = this.getUploadedFile ();
System.out.println ("save the files called");
If (file! = null) {}
System.out.println ("\n file size ==" + files.size ());
for (int i = 0; i < files.size (); i ++) {}
System.out.println ("\n File Name is" + files.get (i) .getFilename ());
System.out.println ("\n the file length is" + files.get (i) .getLength ());
OperationBinding dmsBlobBinding = bindings.getOperationBinding ("CreateInsert");
OperationBinding dmsInfoBinding = bindings.getOperationBinding("CreateInsert1");
OperationBinding dmsApplMapBinding = bindings.getOperationBinding("CreateInsert2");
//-------------------
AttributeBinding atrBlobDocId = (AttributeBinding) bindings.getControlBinding ("DocBlobId");
AttributeBinding atrBlobSeqNo = (AttributeBinding) bindings.getControlBinding ("SeqNo");
AttributeBinding atrBlobDocContent = (AttributeBinding) bindings.getControlBinding ("DocContent");
Information attribute values
AttributeBinding atrInfDocBlobId = (AttributeBinding) bindings.getControlBinding ("DocBlobId1");
AttributeBinding atrInfoSeqNo = (AttributeBinding) bindings.getControlBinding ("SeqNo1");
AttributeBinding atrInfoDocType = (AttributeBinding) bindings.getControlBinding ("DocType");
AttributeBinding atrInfoDocName = (AttributeBinding) bindings.getControlBinding ("DocName");
Card Attrib Valuess
AttributeBinding atrDMSMapDocBlobId = (AttributeBinding) bindings.getControlBinding ("DocBlobId2");
dmsBlobBinding.execute ();
dmsInfoBinding.execute ();
dmsApplMapBinding.execute ();
OperationBinding opBindingSeql = bindings.getOperationBinding("generateDocBlobId");
Map paramsMap = opBindingSeql.getParamsMap ();
String strFirstDocBlobId = opBindingSeql.execute (m:System.NET.SocketAddress.ToString ());
System.out.println ("returned seq impl =" + strFirstDocBlobId);
int intFirstSeqNumber = Integer.parseInt (strFirstDocBlobId);
atrBlobDocId.setInputValue (intFirstSeqNumber);
atrBlobSeqNo.setInputValue (0);
//----------------Blob Table-------------------------
System.out.println ("value of the lob is" + files);
files. Set (i, uploadedFile.get (i));
BlobDomain blobDomain = createBlobDomain (files.get (i));
System.out.println ("blobDomain is" + blobDomain);
Byte [] dataContent = blobDomain.getStorageByteArray ();
//----------------Info Table-------------------------
atrInfDocBlobId.setInputValue (intFirstSeqNumber);
atrInfoSeqNo.setInputValue (0);
atrInfoDocName.setInputValue (files.get (i) .getFilename ());
//--------------Map Table---------------------------
atrDMSMapDocBlobId.setInputValue (intFirstSeqNumber);
int intgetBlob = Integer.parseInt (atrBlobDocId.getInputValue () m:System.NET.SocketAddress.ToString ());
atrBlobDocId.setInputValue (intFirstSeqNumber);
atrInfDocBlobId.setInputValue (intFirstSeqNumber);
try {}
blobFile = FileOperations.writeToBlobDomain (files.get (i));
atrBlobDocContent.setInputValue (blobFile);
} catch (Exception e) {}
e.printStackTrace ();
}
Abvoe all values are defined
try {}
OperationBinding operationBinding = bindings.getOperationBinding ("Commit");
operationBinding.execute ();
} catch (Exception ex) {}
ex.printStackTrace ();
}
}
}
Returns a null value.
}
}
FileOperation.java public class {FileOperations
Public synchronized Shared BlobDomain writeToBlobDomain (UploadedFile imageFile)
throws SQLException, IOException {}
InputStream in = imageFile.getInputStream ();
BlobDomain blobDomain = new BlobDomain();
OutputStream out = blobDomain.getBinaryOutputStream ();
ubyte [] buffer = new byte [8192];
int bytesRead = 0;
While ((bytesRead = in.read (buffer, 0, 8192))! = - 1) {}
out. Write (buffer, 0, bytesRead);
}
in. Close();
Return blobDomain;
}
}
Error log oracle.adfinternal.view.faces.util.ReportableImpl: oracle.jbo.domain.DataCreationException: Houston-25009: failed to create an object of type: java.lang.Integer type: oracle.jbo.domain.BlobDomain with value: karima
at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding._postSetValue(FacesCtrlAttrsBinding.java:183)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding.setInputValue(FacesCtrlAttrsBinding.java:146)
at com.almulla.dms.view.beans.FolderUploadBean.saveFiles(FolderUploadBean.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.el.parser.AstValue.invoke(AstValue.java:254)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:302)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:107)
to oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$ 1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:101)
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:123)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:1083)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:402)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:225)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:280)
to weblogic.servlet.internal.StubSecurityHelper$ ServletServiceAction.run (StubSecurityHelper.java:254)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:192)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:478)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
to org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$ FilterListChain.doFilter (TrinidadFilterImpl.java:478)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:303)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:208)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:202)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
to oracle.security.jps.ee.http.JpsAbsFilter$ 1.run(JpsAbsFilter.java:137)
at java.security.AccessController.doPrivileged (Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:120)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:217)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:225)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.wrapRun (WebAppServletContext.java:3367)
to weblogic.servlet.internal.WebAppServletContext$ ServletInvocationAction.run (WebAppServletContext.java:3333)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564)
to weblogic.servlet.provider.ContainerSupportProviderImpl$ WlsRequestExecutor.run (ContainerSupportProviderImpl.java:254)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
Caused by: oracle.jbo.domain.DataCreationException: Houston-25009: failed to create an object of type: java.lang.Integer type: oracle.jbo.domain.BlobDomain with value: karima
at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:933)
at oracle.jbo.domain.TypeFactory.getInstance(TypeFactory.java:112)
at oracle.jbo.server.AttributeDefImpl.convertToJava(AttributeDefImpl.java:2515)
at oracle.jbo.server.ViewRowImpl.setAttribute(ViewRowImpl.java:1090)
at oracle.adf.model.binding.DCDataControl.setAttributeInRow(DCDataControl.java:2388)
at oracle.adf.model.bc4j.DCJboDataControl.setAttributeInRow(DCJboDataControl.java:2884)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeInRow(JUCtrlValueBinding.java:1175)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValueInRow(JUCtrlValueBinding.java:3010)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2985)
at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2948)
at oracle.adfinternal.view.faces.model.binding.FacesCtrlAttrsBinding.setInputValue(FacesCtrlAttrsBinding.java:145)
... more than 68
Caused by: java.lang.NumberFormatException: for input string: "Karima".
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
in java.lang.Integer. < init > (Integer.java:677)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at oracle.jbo.domain.TypeConvMapEntry.convert(TypeConvMapEntry.java:101)
at oracle.jbo.domain.TypeFactory.get(TypeFactory.java:883)
... more than 78
Maroof
Hello
This post related to my problem in my application have been resolved. I now use for creating data method below.
Private BlobDomain createBlobDomain (file UploadedFile)
{
InputStream in = null;
BlobDomain blobDomain = null;
OutputStream out = null;
Try
{
in = file.getInputStream ();
blobDomain = new BlobDomain();
out = blobDomain.getBinaryOutputStream ();
IOUtils.copy (in, out);
}
catch (IOException e)
{
e.printStackTrace ();
}
catch (SQLException e)
{
e.fillInStackTrace ();
}
Return blobDomain;
}
and other issues as data binding attribute below list file parameter is correct.
atrBlobDocContent.setInputValue (createBlobDomain (files.get (i)));
In my case, it was a stupid mistake in pageDefnitionBinding, here atrBlobDocContent attribute referencing some long type with another VO.
Thanks to Timo Hahn to propose and help debugging.
Maroof
-
Creating a view using causes error ORA-00600
Hello ladies and gentlemen,
I tried to deploy a recursive query, as a point of view in Oracle XE and Standard Edition, nor a lot of success.
The query is in this issue here: http://stackoverflow.com/questions/17358109/how-to-retrieve-all-recursive-children-of-parent-row-in-oracle-sq
with recursion_view(base, parent_id, child_id, qty) as ( -- first step, get rows to start with select parent_id base, parent_id, child_id, qty from md_boms union all -- subsequent steps select -- retain base value from previous level previous_level.base, -- get information from current level current_level.parent_id, current_level.child_id, -- accumulate sum (previous_level.qty + current_level.qty) as qty from recursion_view previous_level, md_boms current_level where current_level.parent_id = previous_level.child_id ) select base, parent_id, child_id, qty from recursion_view order by base, parent_id, child_id
The query itself works and returns the results. However, when I try to create a view with this query, I get errors.
I posted two screenshots: http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/ViewError.jpg and http://www.williverstravels.com/JDev/Forums/StackOverflow/17358109/InternalError.jpg one with the! and * is when I am using JDeveloper 11g, using the navigation database, right-click on the view and select "New View". I get the error when I click on OK. I can indeed create the view through a sql script, but when I try to view the data, I get the error ORA_00600.
I tried it work on my machine the two premises for XE (version 11.2.0.2.0) and 11g Standard Edition (11.2.0.2.v6) via Amazon Web Services. The result is the same.
Does anyone know how to get around this problem?
Not 5 minutes after I have this post, I decide not to use the graphical editor of JDev and simply write
SELECT * FROM BOMS_VIEW;
And it works like a charm. I can not just use data tab to display records in the editor. Wish I'd known that there is 5 hours.
-
Associate data to create a view.
I am currently using a database of Oracle 10.2.0.4.0. I work for the Department of public safety and I am trying to create an Oracle Forms Application that will be used to track information of the mandate. I need to create a view that I can use in my form that will allow me to the warrants list who are associated with each other. In the forms I create these associations in a table by using primary keys for these records.
I created a few fictitious tables with data that you can use to help me create the SQL I can use in the creation of the view, that I need, I hope.
Once the tables are created, the table ORDER_INFO contains detailed information (in real life, it comes to the information related to a mandate). The ASSOCIATE_ORDER table contains the relationships between the records in the ORDER_INFO table. The ASSOCIATE_ORDER table is the one I want to use to create a view that I use in my Application Forms to list all of the warrants that are associated with each other.CREATE TABLE order_info (wp_id number(12) primary key, info varchar2(10), order_no number(12) not null, order_name varchar2(30) not null); insert into order_info (wp_id, info, order_no, order_name) values (1, 'AXE', 123456, 'DOE, JOHN P'); insert into order_info (wp_id, info, order_no, order_name) values (2, null, 245645, 'DOE, JOHN P'); insert into order_info (wp_id, info, order_no, order_name) values (3, 'SHOVEL', 354654, 'DOE, JOHN P'); insert into order_info (wp_id, info, order_no, order_name) values (4, 'PAIL', 432110, 'DOE, JONATHAN'); insert into order_info (wp_id, info, order_no, order_name) values (5, null, 514654, 'DOE, JOHN'); insert into order_info (wp_id, info, order_no, order_name) values (6, null, 687980, 'DOE, JONATHAN'); commit; CREATE TABLE associate_order (wp_id number(12) not null, associated_wp_id number(12) not null, constraint assoc_wp_ip_fk foreign key (associated_wp_id) references order_info(wp_id)); insert into associate_order (wp_id, associated_wp_id) values (2, 1); insert into associate_order (wp_id, associated_wp_id) values (3, 1); insert into associate_order (wp_id, associated_wp_id) values (5, 3); insert into associate_order (wp_id, associated_wp_id) values (6, 4); commit;
If you look at the data in the ASSOCIATE_ORDER table:
WP_ID 2 is associated with WP_ID 1WP_ID ASSOCIATED_WP_ID ----- ---------------- 2 1 3 1 5 3 6 4
WP_ID 3 is associated with WP_ID 1
WP_ID 5 is associated with WP_ID 3
6 WP_ID is associated with 4 WP_ID
I want to be able to do in the view that I have create is something like:
And he have all the primary keys for the warrants (orders in this case) come back to me:SELECT associated_wp_id FROM ORDER_VIEW WHERE WP_ID = 3;
The WP_ID of 1 is not included in the ASSOCIATE_ORDER table, because it is not associated with a previous mandate (order in this case), but because it is associated with WP_ID 2 and 3 I think.ASSOCIATED_WP_ID ---------------- 1 2 3 5
Here are all the commands associated together based on the data that is in the table. There may be 0 to many of these records in the ASSOCIATE_ORDER table, but if they reference a primary key (WP_ID) so I want to include in the view.
I really hope that makes sense. I tried to play a little with analytics, but I'm not even close to the selection of any of the data that I want, so I can't yet show you what I've tried because it probably doesn't even have sense.
Thanks in advance - mike
In order to clean your database if you filled with the scripts above, you can do the following:drop table associate_order; drop table order_info;
Hello
I know right what you want the view to look like.
Given the example of data you posted, that's what you want to the content of the view?WP_ID INFO ORDER_NO ORDER_NAME WP_ID_GRP ----- ---------- ---------- --------------- ---------- 1 AXE 123456 DOE, JOHN P 1 2 245645 DOE, JOHN P 1 3 SHOVEL 354654 DOE, JOHN P 1 4 PAIL 432110 DOE, JONATHAN 4 5 514654 DOE, JOHN 1 6 687980 DOE, JONATHAN 4
? You will notice that it is just order_info, with an additional column, wp_id_grp, added. Wp_id_grp is the lowest related wp_id. For example, wp_ids 1, 2, 3, and 5 are all related, so they all have wp_id_grp = 1.
Here's a way to do it:
CREATE OR REPLACE VIEW order_info_grp AS WITH got_pairs AS ( SELECT wp_id AS x_id , associated_wp_id AS y_id FROM associate_order UNION SELECT associated_wp_id AS x_id , wp_id AS y_id FROM associate_order ) , got_relatives AS ( SELECT CONNECT_BY_ROOT x_id AS wp_id , y_id FROM got_pairs CONNECT BY NOCYCLE y_id = PRIOR x_id ) , got_wp_id_grp AS ( SELECT wp_id , MIN (y_id) AS wp_id_grp FROM got_relatives GROUP BY wp_id ) SELECT o.* , g.wp_id_grp FROM order_info o JOIN got_wp_id_grp g ON o.wp_id = g.wp_id ;
If you want a view which only has the columns wp_id and wp_id_grp, then everything just omit the main request; got_wp_id_grp, it's just what you want.
I guess that the associate_order relationship is reflexive. In other words, instead of:
insert into associate_order (wp_id, associated_wp_id) values (2, 1);
you have it, could just as well, says:
insert into associate_order (wp_id, associated_wp_id) values (1, 2);
In other words, all that matters is that 1 and 2 are linked. What number goes in which column is not relevant.
In table assoiciate_order, why is there a foreign key on associated_wp_id constraint, but not on wp_id?
CONNECT BY is never terribly effective, and NOCYCLE does only make it worse. Depending on your data, in particular how different wp_ids can be in a related group, this may not be practical. You might consider adding a column wp_id_grp in the associate_order table, rather than owning a view and containing a PL/SQL (which would be faster) procedure re - fill this column when associate_order is changed.
Published by: Frank Kulash on April 17, 2013 18:33
MLBrown wrote:
I think I left mouth stumped the Panel...Be patient! It's true that the median time for a first response on this forum is less than 10 minutes, but it's because the first response often only pointed out that we need more information. When you provide all the sample data, and a good explanation of the problem, as you did, then people can begin to solve the problem instead of complaining, complaining is so much faster than problems.
-
Hello
A few ODI experts in this regard, I earlier aid, but unfortunately I could not be implemented.
My oracle database is. My requirement is I have one huge question I use to create a view, but the view of the source and target are in different databases. The subquery suggested options previously provided as this http://www.business-intelligence-quotient.com/?p=1045 only works if the motion of the source and the target table are on the same database. How to accomplish if they are on different databases?If you have a great view, you have many maintenance problems. It is therefore preferable to split in a different subview and make a package with different performance.
You can store all the data in a technical drawing (WRK_ODI) or a procedure that remove the tables at the end.
-
Error message of nonsense trying to create the view
Hello all,.
Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production on Windows 2008R2
I get an error when trying to create a view. The error makes no sense in that didn't evoke any attempt to change a user name or password in the error in production.
I can run the complete select statement very well, I retrieve the results.
If I comment out the line shown as being in error, the problem moves to the line before the tour. 4 lines before the line specified by the error message are similar. The error occurs on the last of the 5 similar lines of code.
If I move all 5 lines above in the code the error moves accordingly.
Function validate_number (near where the error is identified) under certain conditions, it will issue an immediate "alter session set nls_numeric_characters =" execution., "';"
The number of the column identified in the error message is 2 spaces before the validate_number function call.
Here is the syntax for creating the view, the error message is at the bottom.
Figures on the far left indicate the line number. I put 2 blank lines before and after the line of code identified by the error message.
The error points to the 2-seater before the VALIDATE_NUMBER function call on line 350. just before the code sql == > validate_number(Spend_Qty,'')), 0) < ==
Thanks for your time,
Bob
Error in the command line: 350 column: 112CREATE OR REPLACE VIEW REPORT_STAGING_V AS - SELECT - SPEND_STAGING.INPUT_FILE_ID, - SPEND_STAGING.SPEND_ID, - SPEND_STAGING.SPEND_DOC_NUM, - SPEND_STAGING.SPEND_DOC_ITM_NUM, - SPEND_STAGING.SPEND_DOC_YR_NUM, - SPEND_STAGING.ACCT_PYBL_INV_DOC_NUM, - SPEND_STAGING.ACCT_PYBL_INV_FSCL_YR_NUM, - SPEND_STAGING.COMPANY_CODE, - SPEND_STAGING.ACCT_PYBL_INV_LN_ITM_NUM, - SPEND_STAGING.SPEND_DOC_TYPE_CD, - SPEND_STAGING.SPEND_MTHD_TXT, - NVL(SPEND_STAGING.SRC_SYS_CD, '<BLANK>') SRS_SYS_CD, - SPEND_STAGING.SPEND_SAVING_DT, - SPEND_STAGING.SPEND_SAVING_FSCL_WK_NUM, - SPEND_STAGING.SPEND_SAVING_FSCL_MTH_NUM, - SPEND_STAGING.SPEND_SAVING_FSCL_QTR_NUM, - SPEND_STAGING.SPEND_SAVING_FSCL_YR_NUM, - SPEND_STAGING.MTRL_GRP_CD, - SPEND_STAGING.MTRL_GRP_DESC_TXT, - SPEND_STAGING.MTRL_GRP_LVL_1_TXT, - SPEND_STAGING.MTRL_GRP_LVL_2_TXT, - SPEND_STAGING.MTRL_GRP_LVL_3_TXT, - SPEND_STAGING.MTRL_GRP_LVL_4_TXT, - SPEND_STAGING.MTRL_GRP_LVL_5_TXT, - SPEND_STAGING.MTRL_GRP_LVL_6_TXT, - SPEND_STAGING.MTRL_GRP_LVL_7_TXT, - SPEND_STAGING.MTRL_GRP_LVL_8_TXT, - SPEND_STAGING.GL_ACCT_NUM, - SPEND_STAGING.GL_ACCT_DESC, - SPEND_STAGING.COST_CENTR_CD, - SPEND_STAGING.PRFT_CENTR_CD, - SPEND_STAGING.FUNCNL_AREA_CD, - SPEND_STAGING.PURCH_GRP_CD, - SPEND_STAGING.PURCH_GRP_NAM, - SPEND_STAGING.PURCH_ORG_CD, - SPEND_STAGING.PURCH_ORG_NAM, - SPEND_STAGING.REGION_CODE, - SPEND_STAGING.VNDR_ACCT_ROOT_NUM, - SPEND_STAGING.VNDR_CORP_NAM, - SPEND_STAGING.VNDR_CORP_TICKER_SYMBL_CD, - SPEND_STAGING.BUYPOINT_VNDR_ACCT_NUM, - SPEND_STAGING.BUYPOINT_VNDR_FIRST_NAM, - SPEND_STAGING.PAYPOINT_VNDR_ACCT_NUM, - SPEND_STAGING.PAYPOINT_VNDR_FIRST_NAM, - SPEND_STAGING.SPEND_PYMNT_TERM_CD, - SPEND_STAGING.SPEND_PYMNT_TERM_DESC, - SPEND_STAGING.SPEND_PYMNT_BSLN_DT, -50 SPEND_STAGING.SPEND_PYMNT_CLRNG_DT, - SPEND_STAGING.CONTRACTUAL_PYMNT_TERM_DY_CNT, - SPEND_STAGING.VNDR_MTRL_NUM, - SPEND_STAGING.MTRL_ID_1280, - SPEND_STAGING.MTRL_DESC, - SPEND_STAGING.BAT_NUM, - SPEND_STAGING.SPCL_STOCK_IND, - SPEND_STAGING.INVTY_MVMNT_TYPE_CD, - SPEND_STAGING.GOODS_RCPNT_NAM, - SPEND_STAGING.MFG_PART_NUM, - SPEND_STAGING.PLANT_CD, - SPEND_STAGING.PLANT_DESC, - SPEND_STAGING.STORAGE_LOC_CD, - SPEND_STAGING.STORAGE_LOC_DESC, - SPEND_STAGING.UNLOADING_PT_DESC, - SPEND_STAGING.PO_NUM, - SPEND_STAGING.PO_LN_ITM_NUM, - SPEND_STAGING.PO_LN_ITM_LAST_CHNG_DT, - SPEND_STAGING.PO_DOC_DT, - SPEND_STAGING.PO_TYPE_CD, - SPEND_STAGING.PO_TYPE_DESC, - SPEND_STAGING.PO_UOM_CD, - SPEND_STAGING.PO_PYMNT_TERM_CD, - SPEND_STAGING.ASGND_ACCT_CTGRY_TYPE_CD, - SPEND_STAGING.PO_SHORT_TXT, - SPEND_STAGING.GR_MTRL_DOC_TXT, - SPEND_STAGING.ACCT_PYBL_INV_ITM_TXT, - SPEND_STAGING.PO_RCPT_INV_HST_DOC_POST_DT, - SPEND_STAGING.APPRTN_NUM, - SPEND_STAGING.REQTN_TRK_NUM, - SPEND_STAGING.REQTN_LN_NUM, - SPEND_STAGING.REQTN_LN_ITM_NUM, - SPEND_STAGING.REQTN_PERSN_ACCT_ID, - SPEND_STAGING.NTWRK_NUM, - SPEND_STAGING.NTWRK_CTGRY_CD, - SPEND_STAGING.PROJ_NAM, - SPEND_STAGING.WBS_ELMNT_NAM, - SPEND_STAGING.CPTL_PO_IND, - LU_GAC_STAGING.TIER_SUPPLIER, - CASE - WHEN SPEND_STAGING.PRCRMNT_RPTNG_LVL_3_TXT = 'GAC' - AND LU_GAC_STAGING.PO_SHORT_TXT = SPEND_STAGING.PO_SHORT_TXT - AND SPEND_STAGING.SRC_SPLR_NAM IS NULL - THEN LU_GAC_STAGING.TIER_SUPPLIER - ELSE SRC_SPLR_NAM - END SRC_SPLR_NAM, - SPEND_STAGING.TAX_CD, - SPEND_STAGING.TAX_CD_DESC, - SPEND_STAGING.TAX_JURISDICTION_TXT, - SPEND_STAGING.MTRL_DOC_PRCS_UOM_QTY, -100 SPEND_STAGING.MTRL_DOC_UNIT_OF_ENTRY_QTY, - SPEND_STAGING.PO_LN_ITM_QTY, - SPEND_STAGING.PO_LN_ITM_NET_PRC_UNIT_QTY, - SPEND_STAGING.PO_LN_ITM_NET_PRC_USD_AMT, - SPEND_STAGING.PO_LN_ITM_NET_PRC_DC_AMT, - SPEND_STAGING.PO_LN_ITM_NET_PRC_BDGT_USD_AMT, - SPEND_STAGING.PO_LN_ITM_TOT_USD_AMT, - SPEND_STAGING.SPEND_USD_AMT, - SPEND_STAGING.SPEND_DOC_CURNCY_AMT, - SPEND_STAGING.SPEND_LOCAL_CURNCY_AMT, - SPEND_STAGING.SPEND_BDGT_USD_AMT, - SPEND_STAGING.SPEND_QTY, - SPEND_STAGING.SPEND_QTY_UOM_CD, - SPEND_STAGING.SPEND_UNIT_OF_ENTRY_QTY, - SPEND_STAGING.SPEND_UNIT_OF_ENTRY_UOM_CD, - SPEND_STAGING.SPEND_DC_FX_MTH_CNVRSN_FCT_VAL, - SPEND_STAGING.SPEND_DC_FX_BDG_CNVRSN_FCT_VAL, - SPEND_STAGING.CMPNY_LOCAL_CURNCY_CD, - SPEND_STAGING.DOC_CURNCY_CD, - SPEND_STAGING.TRANSTN_TYPE_CD, - SPEND_STAGING.ACCT_ASGNMT_SEQ_NUM, - SPEND_STAGING.GLPCA_LN_ITM_REC_NUM, - SPEND_STAGING.PCA_REF_DOC_NUM, - SPEND_STAGING.CO_DOC_NUM, - SPEND_STAGING.CO_FSCL_YR_NUM, - SPEND_STAGING.CO_LN_ITM_NUM, - SPEND_STAGING.VNDR_REF_DOC_NUM, - SPEND_STAGING.SAVING_MTHD_TXT, - SPEND_STAGING.SAVING_CMNT_TXT, - SPEND_STAGING.SAVING_COND_NUM, - SPEND_STAGING.SAVING_COND_ITM_NUM, - SPEND_STAGING.SAVING_COND_TYPE_CD, - SPEND_STAGING.SAVING_COND_TYPE_DESC, - SPEND_STAGING.SAVING_COND_CURNCY_CD, - SPEND_STAGING.SAVING_COND_PRC_UNIT_UOM_CD, - SPEND_STAGING.SAVING_COND_PRC_UNIT_QTY, - SPEND_STAGING.SAVING_COND_RTE_USD_AMT, - SPEND_STAGING.SAVING_COND_CURNCY_CNVRSN_VAL, - SPEND_STAGING.SAVING_COND_CURNCY_BDGT_CNVRSN, - SPEND_STAGING.PO_TRANSTN_COND_DC_AMT, - SPEND_STAGING.PO_TRANSTN_COND_USD_AMT, - SPEND_STAGING.SAVING_RTE_PER_USD_AMT, - SPEND_STAGING.SAVING_PER_USD_AMT, - SPEND_STAGING.SAVING_PER_BDGT_USD_AMT, - SPEND_STAGING.AVOIDANCE_USD_AMT, - SPEND_STAGING.AVOIDANCE_BDGT_USD_AMT, - SPEND_STAGING.SAVING_USD_AMT, - SPEND_STAGING.SAVING_BDGT_USD_AMT, - SPEND_STAGING.NO_FX_SAVING_USD_AMT, - SPEND_STAGING.NO_FX_AVOIDANCE_USD_AMT, -150 SPEND_STAGING.TOT_REDUCTN_USD_AMT, - SPEND_STAGING.TOT_REDUCTN_BDGT_USD_AMT, - SPEND_STAGING.TOT_NO_FX_REDUCTN_USD_AMT, - SPEND_STAGING.PAYMENTNET_TRANSTN_NUM, - SPEND_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM, - SPEND_STAGING.ROW_CRTE_GMT_DTTM, - SPEND_STAGING.ROW_MODIFY_GMT_DTTM, - SPEND_STAGING.ROW_CRTE_MST_DTTM, - SPEND_STAGING.ROW_MODIFY_MST_DTTM, - SPEND_STAGING.PRCRMNT_DIRECTOR_NAM, - SPEND_STAGING.PRCRMNT_PLANT_DSGNTN, - SPEND_STAGING.PRCRMNT_RPTNG_LVL_1_TXT, - SPEND_STAGING.PRCRMNT_RPTNG_LVL_2_TXT, - SPEND_STAGING.PRCRMNT_RPTNG_LVL_3_TXT, - SPEND_STAGING.SPEND_CAT_ID, - SPEND_STAGING.SPEND_RULE_ID, - SPEND_STAGING.TRANSACTION_DATE, - SPEND_STAGING.SPEND_AMOUNT, - SPEND_STAGING.ITEM_DESCRIPTION, - SPEND_STAGING.SUPPLIER_ID, - CASE - WHEN SPEND_STAGING.SOURCE ='SPEND' - THEN 'Spend and Savings' - WHEN SPEND_STAGING.SOURCE ='TRAVEL' - THEN 'Travel' - ELSE NULL - END SOURCE, - SPEND_STAGING.SUPPLIER_NUMBER, - SPEND_STAGING.TRAVEL_PERSNO, - SPEND_STAGING.TRIP, - SPEND_STAGING.TRAVEL_DOC, - SPEND_STAGING.TRAVEL_EXPTY, - SPEND_STAGING.TRAVEL_EXP_TYPE_DESC, - SPEND_STAGING.TRAVLE_CREDIT_CARD_TRAN_DESC TRAVEL_CREDIT_CARD_TRAN_DESC, - SPEND_STAGING.COUNTRY_CODE, - SPEND_STAGING.TRAVEL_INFO, - SPEND_STAGING.TRAVEL_ID, - SPEND_STAGING.TRAVEL_DOCUMENT_NUMBER, - SPEND_STAGING.TRAVEL_LAST_NAME_FIRST_NAME, - SPEND_STAGING.TRAVEL_TRIP_REASON, - SPEND_STAGING.TRAVEL_TRIP_STATUS, - SPEND_STAGING.TRAVEL_RATE, - SPEND_STAGING.FINANCE_ORG, - SPEND_STAGING.ASSOCIATED_MG_CODE, - SPEND_STAGING.COUNTRY_DESC, - SPEND_STAGING.TRAVEL_ID_DESC_BANKCARD, - SPEND_STAGING.COMPANY_CODE_DESC, - SPEND_STAGING.COST_CENTER_DESC, - 'Q'||TO_CHAR(SPEND_STAGING.TRANSACTION_DATE,'Q') QUARTERNAME, - TO_CHAR(SPEND_STAGING.TRANSACTION_DATE,'YYYY') YEARNAME, -200 CASE - WHEN SPEND_STAGING.SRC_SYS_CD = 'P-CARD' - THEN SS2.CLEANSED_PARENT_NAME - ELSE SS1.CLEANSED_PARENT_NAME - END CLEANSED_PARENT_NAME, - CASE - WHEN SPEND_STAGING.SRC_SYS_CD = 'P-CARD' - THEN SS2.cleansed_name_1 - ELSE SS1.cleansed_name_1 - END CLEANSED_NAME1, - CASE - WHEN SPEND_STAGING.MTRL_ID_1280 IS NULL - AND SPEND_STAGING.VNDR_MTRL_NUM IS NOT NULL - THEN SPEND_STAGING.VNDR_MTRL_NUM - WHEN SPEND_STAGING.MTRL_ID_1280 IS NULL - AND SPEND_STAGING.VNDR_MTRL_NUM IS NULL - AND SPEND_STAGING.MFG_PART_NUM IS NOT NULL - THEN SPEND_STAGING.MFG_PART_NUM - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZAR' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280||'-MIX' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZAR' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-MIX' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZSA' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ASMBLY' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZSA' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ASMBLY' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZST' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-TEST' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZST' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-TEST' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZBI' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL -250 THEN SPEND_STAGING.MTRL_ID_1280 - ||'-BURN-IN' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZBI' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-BURN-IN' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZRJ' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-REJECT' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZRJ' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-REJECT' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZPR' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-PROBE' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZPR' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-PROBE' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEF' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENG' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEF' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENG' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEM' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENG' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEM' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENG' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEU' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL -300 THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENGWFR' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEU' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENGWFR' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZSF' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-WFR' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZSF' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-WFR' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEF' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENG' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.PO_TYPE_CD = 'ZEF' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-ENG' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EFM' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-POTypeCode' - WHEN SPEND_STAGING.MTRL_GRP_LVL_4_TXT = 'EWM' - AND SPEND_STAGING.MTRL_ID_1280 IS NOT NULL - THEN SPEND_STAGING.MTRL_ID_1280 - ||'-POTypeCode' - ELSE SPEND_STAGING.MTRL_ID_1280 - END ReportingPartNum, - LU_PCARD_STAGING.COST_CENTR_CD PCARD_COST_CENTR_CD, - LU_PCARD_STAGING.CTY_NAM PCARD_CTY_NAM, - LU_PCARD_STAGING.DISABLE_LINE PCARD_DISABLE_LINE, - LU_PCARD_STAGING.DISABLED_OWNED_BIZ_FLG PCARD_DISABLED_OWNED_BIZ_FLG, - LU_PCARD_STAGING.DIVERSITY_VNDR_FLG PCARD_DIVERSITY_VNDR_FLG, - LU_PCARD_STAGING.FIELD PCARD_FIELD, - LU_PCARD_STAGING.GL_ACCT_NUM PCARD_GL_ACCT_NUM, - LU_PCARD_STAGING.HUB_ZONE_SMALL_BIZ_CONCERN_FLG PCARD_HUB_ZONE, - LU_PCARD_STAGING.MINORITY_OWNED_BIZ_FLG PCARD_MINORITY_OWNED_BIZ_FLG, - NVL(validate_number(Po_Ln_Itm_Net_Prc_Usd_Amt,'')/DECODE(validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,''),0,1,validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,'')),0) po_unit_price_per_1_usd, - NVL(validate_number(Po_Ln_Itm_Net_Prc_Dc_Amt,'') /DECODE(validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,''),0,1,validate_number(Po_Ln_Itm_Net_Prc_Unit_Qty,'')),0) po_unit_price_per_1_doc_cur, - NVL(validate_number(Spend_Bdgt_Usd_Amt,'') /DECODE(validate_number(Spend_Qty,''),0,1, validate_number(Spend_Qty,'')),0) spend_up_per_1_usd_budgt_rate, - NVL(validate_number(Spend_Usd_Amt,'') /DECODE(validate_number(Spend_Qty,''),0,1, validate_number(Spend_Qty,'')),0) spend_up_per_1_usd_mon_rate, -350 NVL(validate_number(Spend_Doc_Curncy_Amt,'') /DECODE(validate_number(Spend_Qty,''),0,1, validate_number(Spend_Qty,'')),0) Spend_UP_per_1_Doc_Curr, - - TO_CHAR(TRANSACTION_DATE,'MM-YYYY') MONTH_YEAR, - LU_PCARD_STAGING.MTRL_GRP_CD PCARD_MTRL_GRP_CD, - LU_PCARD_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM PCARD_PAY_TRANSTN_LN_ITM_NUM, - LU_PCARD_STAGING.PAYMENTNET_TRANSTN_NUM PCARD_PAY_TRANSTN_NUM, - LU_PCARD_STAGING.PAYMENTNET_TRANSTN_POST_DT PCARD_PAY_TRANSTN_POST_DT, - LU_PCARD_STAGING.PCARD_INV_AMT PCARD_INV_AMT, - LU_PCARD_STAGING.PCARD_INV_CURNCY_CD PCARD_INV_CURNCY_CD, - LU_PCARD_STAGING.PCARD_INV_DT PCARD_INV_DT, - LU_PCARD_STAGING.PCARD_INV_LN_ITM_AMT PCARD_INV_LN_ITM_AMT, - LU_PCARD_STAGING.PCARD_INV_LN_ITM_TAX_AMT PCARD_INV_LN_ITM_TAX_AMT, - LU_PCARD_STAGING.PCARD_INV_LN_ITM_TAX_CD PCARD_INV_LN_ITM_TAX_CD, - LU_PCARD_STAGING.PCARD_INV_REF_NUM PCARD_INV_REF_NUM, - LU_PCARD_STAGING.PCARD_INV_TAX_AMT PCARD_INV_TAX_AMT, - LU_PCARD_STAGING.PCARD_MERCHANT_NAM PCARD_MERCHANT_NAM, - LU_PCARD_STAGING.PCARD_OWNR_ID PCARD_OWNR_ID, - LU_PCARD_STAGING.PCARD_SHORT_TXT PCARD_SHORT_TXT, - LU_PCARD_STAGING.PCARD_SRC_FILE_NAM PCARD_SRC_FILE_NAM, - LU_PCARD_STAGING.PLANT_CD PCARD_PLANT_CD, - LU_PCARD_STAGING.PURCH_GRP_CD PCARD_PURCH_GRP_CD, - LU_PCARD_STAGING.RCPNT_ID PCARD_RCPNT_ID, - LU_PCARD_STAGING.REQTN_CRTE_BY_ID PCARD_REQTN_CRTE_BY_ID, - LU_PCARD_STAGING.REQTN_LN_ITM_NUM PCARD_REQTN_LN_ITM_NUM, - LU_PCARD_STAGING.REQTN_NUM PCARD_REQTN_NUM, - LU_PCARD_STAGING.SERV_DISABLE_VETERAN_BIZ_FLG PCARD_SERV_DIS_VET_BIZ_FLG, - LU_PCARD_STAGING.STATE_CD PCARD_STATE_CD, - LU_PCARD_STAGING.STATE_CD, - LU_PCARD_STAGING.VETERAN_OWNED_BIZ_FLG PCARD_VETERAN_OWNED_BIZ_FLG, - LU_PCARD_STAGING.VNDR_ACCT_NUM PCARD_VNDR_ACCT_NUM, - LU_PCARD_STAGING.WOMAN_OWNED_BIZ_FLG PCARD_WOMAN_OWNED_BIZ_FLG2, - DENSE_RANK() OVER (ORDER BY NVL(TO_CHAR(TRANSACTION_DATE, 'YYYYMM'),'190010') DESC) AS DATE_RANK, - LU_PRICE_BY_UNIT_STAGING.MTRL_GRP PBU_MTRL_GRP, - LU_PRICE_BY_UNIT_STAGING.MTRL_GRP_DES PBU_MTRL_GRP_DES, - LU_PRICE_BY_UNIT_STAGING.MTRL_ID PBU_MTRL_ID, - LU_PRICE_BY_UNIT_STAGING.PLANT PBU_PLANT, - LU_PRICE_BY_UNIT_STAGING.PLANT_DESC PBU_PLANT_DESC, - LU_PRICE_BY_UNIT_STAGING.SUPPLIER PBU_SUPPLIER, - LU_PRICE_BY_UNIT_STAGING.DESCRIPTION PBU_DESCRIPTION, - LU_PRICE_BY_UNIT_STAGING.UOM PBU_UOM, - LU_PRICE_BY_UNIT_STAGING.CONTENT_VOLUME PBU_CONTENT_VOLUME, - LU_PRICE_BY_UNIT_STAGING.UOM_CONTENT_VOLUME PBU_UOM_CONTENT_VOLUME, - LU_PRICE_BY_UNIT_STAGING.CONTENT_WEIGHT PBU_CONTENT_WEIGHT, - LU_PRICE_BY_UNIT_STAGING.UOM_CONTENT_WT PBU_UOM_CONTENT_WT, - LU_PRICE_BY_UNIT_STAGING.PRICE__PACKAGE PBU_PRICE__PACKAGE, - LU_PRICE_BY_UNIT_STAGING.PRICE_PER_UOM_WT PBU_PRICE_PER_UOM_WT, - LU_PRICE_BY_UNIT_STAGING.PRICE_PER_UOM_VOL PBU_PRICE_PER_UOM_VOL, - LU_PRICE_BY_UNIT_STAGING.COMMON_NAME PBU_COMMON_NAME, - LU_GAC_UOM_REFERENCE_STAGING.LU_GAC_UOM_REFERENCE_ID, - LU_GAC_UOM_REFERENCE_STAGING.FSL_PART_NUMBER, - LU_GAC_UOM_REFERENCE_STAGING.SUPPLIER LU_GAC_SUPPLIER, -400 LU_GAC_UOM_REFERENCE_STAGING.DESCRIPTION LU_GAC_DESCRIPTION, - LU_GAC_UOM_REFERENCE_STAGING.GAC_MAT_SUBGROUP LU_GAC_MAT_SUBGROUP , - LU_GAC_UOM_REFERENCE_STAGING.ACTUAL_FILL LU_GAC_ACTUAL_FILL, - LU_GAC_UOM_REFERENCE_STAGING.COMMON__UOM LU_GAC_COMMON_UOM, - LU_GAC_UOM_REFERENCE_STAGING.PACKAGE LU_GAC_PACKAGE - FROM - SPEND_STAGING, - SUPPLIER_STAGING SS1, - SUPPLIER_STAGING SS2, - LU_GAC_STAGING, - lu_card_code_staging, - LU_PCARD_STAGING, - LU_PRICE_BY_UNIT_STAGING, - LU_GAC_UOM_REFERENCE_STAGING - WHERE SS1.SUPPLIER_ID(+) = SPEND_STAGING.SUPPLIER_ID - AND SS2.PCARD_INV_REF_NUM(+) = SPEND_STAGING.PCARD_INV_REF_NUM - AND SS2.PAYMENTNET_TRANSTN_NUM(+) = SPEND_STAGING.PAYMENTNET_TRANSTN_NUM - AND SS2.PAYMENTNET_TRANSTN_LN_ITM_NUM(+) = - SPEND_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM - AND lu_card_code_staging.card_code(+) = spend_staging.travel_id - AND lu_gac_staging.po_short_txt(+) = spend_staging.po_short_txt - AND LU_PCARD_STAGING.PCARD_INV_REF_NUM(+) = SPEND_STAGING.PCARD_INV_REF_NUM - AND LU_PCARD_STAGING.PAYMENTNET_TRANSTN_NUM(+) = - SPEND_STAGING.PAYMENTNET_TRANSTN_NUM - AND LU_PCARD_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM(+) = - SPEND_STAGING.PAYMENTNET_TRANSTN_LN_ITM_NUM - AND LU_PRICE_BY_UNIT_STAGING.MTRL_ID(+) = SPEND_STAGING.MTRL_ID_1280 - AND LU_PRICE_BY_UNIT_STAGING.PLANT(+) = SPEND_STAGING.PLANT_CD - AND lu_gac_uom_REFERENCE_STAGING.fsl_part_number(+) = -431 SPEND_STAGING.MTRL_ID_1280;
Error report:
SQL error: ORA-01031: insufficient privileges
01031 00000 - "insufficient privileges".
* Cause: An attempt was made to change the user name or password
without the privilege appropriate. This error also occurs if
trying to install a database without the need for employment
access privileges.
When Trusted Oracle is configure in DBMS MAC, this error may occur
If the user has been granted the privilege necessary for a higher label
that the connection is active.
* Action: Ask the database to perform the operation or grant administrator
the required privileges.
For users Trusted Oracle get this error, well that granted the
the privilege that is suitable for the top label, ask the database
administrator to grant the privilege to the appropriate label.
Published by: Snyds on May 24, 2012 07:46The text associated with the error number is certainly misleading.
It simply means that you have not had the privilege to do something.
Is validate_number in the same pattern when you create the view? If not, what
privileges that you have about this feature and how is it given? -
Creating a view using multiple joins - by reducing the number of output lines
It is difficult to put into words exactly what I want to implement, so I'll just use an example. Let's say I have the following database:
game (id, time, place)
Reader (game_id, name)
Referee (game_id, name)
Foreign keys:
Player (game_id) references game (id)
Referee (game_id) references game (id)
It is a very special match, in which:
A game can have 1 to many players
A game can have from 1 to several arbitrators
I want to create the following view:
Game_overview (Game_id, time, player, referee)
It's easy to create this view with the following output:
Game1, 15:00, player1, Referee1
Game1, 15:00, player1, Referee2
Game1, 15:00, player2, Referee1
Game1, 15:00, player2, Referee2
Game1, 15:00, Joueur3, null
08:00, player1, Referee1, GaMe2
GaMe2, 08:00, player1, Referee2
HOWEVER, I want it to look like this:
Game1, 15:00, player1, Referee1
Game1, 15:00, player2, Referee2
Game1, 15:00, Joueur3, null
08:00, player1, Referee1, GaMe2
GaMe2, 08:00, null, Referee2
I think that this should not be TOO difficult to solve, but I can't really get my head around it.Welcome to the forum!
Whenever you have a problem, please post CREATE TABLE and INSERT statements for your sample data. Sinve it's your first post, I'll do it for you:
CREATE TABLE game ( id VARCHAR2 (10) PRIMARY KEY , time VARCHAR2 (10) --, location VARCHAR2 (10) -- No need to include columns that play no role in this problem ); INSERT INTO game (id, time) VALUES ('Game 1', '3PM'); INSERT INTO game (id, time) VALUES ('Game 2', '8AM'); CREATE TABLE player ( game_id VARCHAR2 (10) , name VARCHAR2 (10) ); INSERT INTO player (game_id, name) VALUES ('Game 1', 'Player 1'); INSERT INTO player (game_id, name) VALUES ('Game 1', 'Player 2'); INSERT INTO player (game_id, name) VALUES ('Game 1', 'Player 3'); INSERT INTO player (game_id, name) VALUES ('Game 2', 'Player 1'); CREATE TABLE referee ( game_id VARCHAR2 (10) , name VARCHAR2 (10) ); INSERT INTO referee (game_id, name) VALUES ('Game 1', 'Referee 1'); INSERT INTO referee (game_id, name) VALUES ('Game 1', 'Referee 2'); INSERT INTO referee (game_id, name) VALUES ('Game 2', 'Referee 1'); INSERT INTO referee (game_id, name) VALUES ('Game 2', 'Referee 2');
In this way, people who want to help you can recreate the problem and test their ideas.
In addition, to say what version of Oracle you are using. The following query will work in Oracle 9.1 or more.
What you asked is what I call a Query, fixed-price , and this is a way to do it:
WITH player_plus AS ( SELECT game_id , name , ROW_NUMBER () OVER ( PARTITION BY game_id ORDER BY name ) AS r_num FROM player ) , referee_plus AS ( SELECT game_id , name , ROW_NUMBER () OVER ( PARTITION BY game_id ORDER BY name ) AS r_num FROM referee ) SELECT g.id , g.time , p.name AS player_name , r.name AS referee_name FROM player_plus p FULL OUTER JOIN referee_plus r ON p.game_id = r.game_id AND p.r_num = r.r_num JOIN game g ON g.id = COALESCE (p.game_id, r.game_id) ORDER BY g.id , COALESCE (p.r_num, r.r_num) ;
Output:
ID TIME PLAYER_NAM REFEREE_NA ---------- ---------- ---------- ---------- Game 1 3PM Player 1 Referee 1 Game 1 3PM Player 2 Referee 2 Game 1 3PM Player 3 Game 2 8AM Player 1 Referee 1 Game 2 8AM Referee 2
I see that you have more arbitrators than players in a game. If such was not the case, then you might make it a bit more efficient using a LEFT OUTER JOIN between p and r, rather than a FULL OUTER JOIN, and you can also use only the columns of p where I use COALESCE.
Published by: Frank Kulash, March 9, 2012 18:15
Fixed spelling -
Bug: Cannot create materialized view log on XE 11 G
Hello
I connect as try and HR user create materialized view log
I get the errorCREATE MATERIALIZED VIEW LOG ON HR.EMPLOYEES;
>
Error from the 1 in the command line:
CREATE LOG VIEW MATERIALIZED ON HUMAN RESOURCES. EMPLOYEES
Error in the command line: 1 column: 0
Error report:
SQL error: ORA-00439: feature not enabled not: Advanced replication
00439 00000 - "function not enabled: %s."
* Cause: The specified feature is not enabled.
* Action: Try not to use this feature.
>
You can create a materialized view log on 10G XE with no problems.
Kind regards
Jari
http://dbswh.webhop.NET/dbswh/f?p=blog:Home:0Is this a bug in 11g or 10g?
It was reported earlier in the beta forum now archived. {: identifier of the thread = 2214092}
The current doc lists the MV sites only (and 'No' to the function of replication advanced):
http://download.Oracle.com/docs/CD/E17781_01/license.112/e18068/TOC.htm#BABDFDAI -
Pls help me in creating a view
Hi all
We have a few tables in Oracle HRMS, per_jobs table gives details of all defined jobs,
PAY_JOB_WC_CODE_USAGES table contains all the compensation codes defined and PAY_STATE_RULES
table contains all status codes.
Now SELECT WC. STATE_CODE,
PJ. JOB_ID,
PSR.NAME STATE_NAME,
PJ.NAME JOB_NAME
OF per_jobs pj,.
PAY_JOB_WC_CODE_USAGES WC,
ESP PAY_STATE_RULES
WHERE PJ. JOB_ID (+) IS WC. JOB_ID
AND WC. STATE_CODE (+) IS ESP. STATE_CODE
This query gives the job_names that are defined in a State...
But, now, is what I want
I want to get the names of work that are not defined in each State for this I want to create a view
So, could u pls help me to write this query.
Example,
SELECT * FROM PER_JOBS
If job_id in (select job_id from PAY_JOB_WC_CODE_USAGES where STATE_CODE = "GO")
This will give you the details on employment that are not defined in the State called "WILL"...
But I want that all the jobs that are not defined in all States...
Thank youselect psr.state_code, pj.* from per_jobs pj ,pay_job_wc_code_usages wc ,pay_state_rules psr where pj.job_id = wc.job_id and not exists (select 1 from pay_job_wc_code_usages wc1 where wc1.job_id = pj.job_id and wc1.state_code = psr.state_code);
I think that could do it. Not tested.
-
With as subquery block in create MATERIALIZED view or bulk pl/sql
Hi all
Can I use the with as subquery block in create MATERIALIZED view?
or in pl/sql
-Thank you
Published by: xwo0owx on March 31, 2011 11:23
Published by: xwo0owx on March 31, 2011 11:23Have you tried to test it? :)
SQL > SELECT * FROM V$VERSION; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production TNS for 32-bit Windows: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production SQL > CREATE VIEW TEST_VIEW 2 AS 3 WITH d AS 4 ( 5 SELECT * FROM DUAL 6 ) 7 SELECT * 8 FROM d 9 ; View created. SQL > SELECT * FROM test_view; D - X SQL > DECLARE 2 x DUAL.DUMMY%TYPE; 3 BEGIN 4 WITH d AS 5 ( 6 SELECT * FROM DUAL 7 ) 8 SELECT dummy 9 INTO x 10 FROM d 11 ; 12 13 DBMS_OUTPUT.PUT_LINE(x); 14 END; 15 / X PL/SQL procedure successfully completed.
-
Create the view with the Unique ID column
I need to create a view.
The view is created using unions on 4 tables.
The problem is that I need to create a unique id column in the view that I use in an Oracle Apex application and need to drill down to each line.
Any help appreciated
GusYou cannot use oracle sequences directly in the query that is connected with other queries using Union or INTERSECT or less cluses.
Other cases where you cannot use a sequence are:
-In a WHERE clause
-In a GROUP BY or ORDER BY clause
-In a SEPARATE clause
-Along with a UNION or INTERSECT or LESS
-In a subqueryIn order to better you will love
Select seqname.nextval, col1, col2
Of
(
Union
..
..
)as mentioned in one of the previous answer by the other members of the community...
Alternatively, you can use rownum speed of sequence to a unique number as below examle:
Select rownum, col1, col2
Of
(
Union
..
..
)Kind regards
Lifexisxnotxsoxbeautiful... -
Hello
I found that when oracle executes the create materialized view statement it must be longer than the duration of execution of the actual query.
I do an IMMEDIATE CONSTRUCTION.
Is there a reason for this?
For example. the query in the create statement took 25 minutes and did not create the MV for 2 hours.
The following query, which took 10 seconds was not created during more than 11 minutes and is still ongoing.
So I want to know what the reason is behind this? pls share if you know... Thank you.
PS:
I have advice in the select query. Oracle uses it advice during the creation of MV too or is this the reason why it's taking the time to build the MV?
any suggestion is appreciated. thnks!
Published by: user254668 on January 11, 2011 08:08How do measure you queries?
http://jonathanlewis.WordPress.com/2010/08/29/fair-comparison/
Re: Question Performace and Order by
Re: receiving ORA-01722 invalid number mistake while creating a materialized view
Re: long term with ORDER by clause
Re: Improve the performance of the query with the order of
Maybe you are looking for
-
How to enable/disable cookies in Firefox for iOS?
How to enable/disable cookies in Firefox for iOS?
-
shortcut brightness multiplied by 3
Hello, if I press Fn + origin or end a higher, or lower brightness through three - zero to three, etc. 6. In Control Panel, I can move a mouse cursor, so if I do one, it goes one, four, seven, etc.. What can I do with this funny problem? I have windo
-
Need help with the reactivation of windows xp
I clicked on a security message that came when I turned on my pc. It was obviously the wrong thing to do and probably some kind of scam. He deleted the installation windows completely. Now it says I have to reactivate windows xp. I found the product
-
I can't play any file on wmp11 get only blue screen
I updated my video card
-
I need a replacement for a HP Pavilion MS225 processor fan all in one office.
I was told that the part's owner but HP brings more of the part - and I was not able to find a used or refurbished fan. How can this happen? The computer is less than 2 years old!