Use of view in database.
What is the use of view? What is the difference between table and view?
Your best bet is to review the [concepts guide|http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/toc.htm] for the answer:
ViewsViews are customized presentations of data in one or more tables or other views. A view can also be considered a stored query. Views do not actually contain data. Rather, they derive their data from the tables on which they are based, referred to as the base tables of the views.
Like tables, views can be queried, updated, inserted into, and deleted from, with some restrictions. All operations performed on a view actually affect the base tables of the view.
Views provide an additional level of table security by restricting access to a predetermined set of rows and columns of a table. They also hide data complexity and store complex queries.>
TablesTables are the basic unit of data storage in an Oracle database. Database tables hold all user-accessible data. Each table has columns and rows. A table that has an employee database, for example, can have a column called employee number, and each row in that column is an employee's number.
Similar Messages
-
Include or create a view in the database and use this view?
Well, I need to get related data of the main table from another related tables, so one way to do that is to use the Include method in Entity Framework to get this related data.
However, I am thinking in another option, create a view in the database and use this view in entity framework. In this way, I avoid the needed of the include, because I think that is expensive in resources. But I am no very sure about that.
I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
For example, if I use the include I have the advantage that I get only one the main record and all the related data I have in the navigation properties, so the info is more shorted.
Which is the advanteges and disadvantages of both methods to get related data in entity framework?
Thank so much.Hello ComptonAlvaro,
>>I would like to know if the use of views on entity framework is a good idea to improve the performace or is better to use the include.
If your view would use a Join syntax to query master-child relationship tables, it actually is similar with the Include() method which actually results a duplicate records from master table, you could check this
link for detail description.
>>Which is the advanteges and disadvantages of both methods to get related data in entity framework?
One visible difference is that records from Views are not editable by default(if you want edit them, you could refer to this
blog).
In your case, my suggestion that you could use the lazying load which will load the matter table once and disable the trace if you only need to display data.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to find Logical database name using selection view
Hi Experts,
How can we find logical database name using selection view in se36.
Regards,
ManiHi,
If you want to see the logincal database used in the report ( tcode se38) in the intial screen select the attribute tab
and click display you will bw able to see the logical datbase ysed for the report.
Thanks. -
Find long running database objects over week (without using V$ views)
find long running database objects over week (without using V$ views) as v$ views contains information only upto objects resides on main memory . I want to know the objects which takes highest time withing one week.
Hello,
welcome to the forum.
This is the forum for the tool {forum:id=260}. Your question about v$views should be posted in {forum:id=61} or {forum:id=75}. There is a FAQ {message:id=9360002}: especially the part about providing essential informations like 4 digit version number :-)
Regards
Marcus -
Creating a View at Database level to be used in an another application
Posted - 01/20/2012 : 11:43:27
I have a table Named Customer_Distribution in which we store all the recepient information based on a request submitted by the customer.
Maximum number of recepients for a request is 3.So if a customer submits a request with 3 recepients the Customer_Distribution table will have 3 records inserted for the request as below
ReqNo recepientdesc recepientname recepientemail
1 R Abc [email protected]
1 U xyz [email protected]
1 S sap [email protected]
I'm trying to create a view and need help to create the view such that the entire Request Information is in a single row rather than multiple rows as we are trying to use this view in another application where it will be easy to retreive if the entire information is in a single row
The View should have the data in the below format
ReqNo desc1 name1 email1 desc2 name2 email2 desc3 name2 email2
1 R Abc [email protected] U Xyz [email protected] S sap [email protected]
Thanksuser12946819 wrote:
Hi
Would you be able to elaborate more on your response as i am new to oracle and have hard time using your response
Thanks
ME_XE?with
2 data as
3 (
4 select 1 as ReqNo, 'R' as recepientdesc, 'Abc' as recepientname, '[email protected]' as recepientemail from dual union all
5 select 1 , 'U', 'xyz', '[email protected]' from dual union all
6 select 1 , 'S', 'sap', '[email protected]' from dual union all
7 select 2 , 'Q', 'me', '[email protected]' from dual
8 )
9 select
10 ReqNo,
11 max( decode( rn, 1, recepientdesc)) as desc1,
12 max( decode( rn, 2, recepientdesc)) as desc2,
13 max( decode( rn, 3, recepientdesc)) as desc3,
14 max( decode( rn, 1, recepientname)) as name1,
15 max( decode( rn, 2, recepientname)) as name2,
16 max( decode( rn, 3, recepientname)) as name3,
17 max( decode( rn, 1, recepientemail)) as email1,
18 max( decode( rn, 2, recepientemail)) as email2,
19 max( decode( rn, 3, recepientemail)) as email3
20 from
21 (
22 select
23 ReqNo, recepientdesc, recepientname, recepientemail,
24 row_number() over (partition by ReqNo order by recepientdesc asc) as rn
25 from data
26 )
27 group by ReqNo;
REQNO DES DES DES NAME1 NAME2 NAME3 EMAIL1 EMAIL2 EMAIL3
1 R S U Abc sap xyz [email protected] [email protected] [email protected]
2 Q me [email protected]
2 rows selected.
Elapsed: 00:00:00.01
ME_XE?In the future, posting sample data in a format that someone can easily use (like i did above) will get you answers a lot quicker. I'm in a decently good mood this morning so i did it myself. 7 times out of 10 i'll skip over questions that don't make it easy for me to help. Just an FYI to help you in future posting. -
How to Create a BC4J messageChoice using an View?
I just started using UIX (today in fact) and would like to know how to use a View Object to populate a BC4J messageChoice.
I've created an form to update a table. One of the fields is cost center. I store the different cost centers in a seperate table. Then I store the id of the costCenter in the project table. I don't want to hard code the different centers into the application but pull them from the database (using a BC4J view). Can someone point me in the right direction?
Thanks!That worked! But when I hit the update button the messageChoice fields will not update in the database. All the other fields do. No errors are displayed either, am I missing something?
Here is the code from the messageChoice...
<bc4j:messageChoice prompt="Status"
attrName="ProjectStatusId">
<contents>
<bc4j:optionList voName="ProjectStatusView"
attrName="ProjectStatusId"
textAttrName="Description" />
</contents>
</bc4j:messageChoice> -
Using a view instead of a select statement
Greetings Abapers
Ive got a problem. Im writing a program and one of the things i do is i use 2 select statements which are as follows:
Read all organisational relationships for all business partneru2019s linked to sales codes for all date ranges
select * from hrp1001 into table lt_hrp1001 " Get all external business partners
where plvar eq '01'
and sclas eq 'BP'
and relat eq '008'
or relat eq 'Z40'.
select * from hrp1001 appending corresponding fields of table lt_hrp1001 "Get all employees
where plvar eq '01'
and sclas eq 'BP'
and relat eq '291'
and otype eq 'S'.
I have however been told that i can use the database view HRVPADIC since the hrp1001 table is giving me duplicats which i dont want. Can anyone tell me how to use this view i.e. syntax and logic. I would really appreciate it.Well, I don't see how using the view would be better. Why don't you just get all of the data at once:
SELECT * FROM hrp1001 INTO TABLE lt_hrp1001
WHERE plvar EQ '01'
AND sclas EQ 'BP'
AND ( ( relat EQ '008'
OR relat EQ 'Z40' )
OR relat EQ '291'
AND otype EQ 'S' ).
(I didn't test this so check it.)
Rob -
Using SQL view object to create ADF table
Hi,
I have created a column called "Month" (which extracts month from the date column) and another column to count the no. of requests.
i want to create an ADF table with 2 columns, a column showing the month and another is showing the no. of requests for that month.
However, now I only managed to achieve the ADF table to show the overall total requests, which means if i add up all the requests for all the months and i get 500
My ADF table shows this:
Jan: 500
Feb: 500
Mar: 500
How should I create the view or what should I do to make it such that the no. of request is based on the month?
Please advice.
Thanks (:Hi,
For the given situation you can create a Query Based View Object with the following query
SELECT
COUNT(TEMP1.DT) REQUEST,
TO_CHAR(TEMP1.DT, 'Mon') MONTH
FROM
TEMP1
GROUP BY
TO_CHAR(TEMP1.DT, 'Mon')
where DT is the date column and temp1 is the name of the database table.
Following are the steps that i followed to get this query :
i have taken the following sample table :
create table temp1
(srno number primary key,
dt date)
*Note you may use any existing column instead of srno or use dt only (i took an extra column as u know we need a primary key /row id)
the following is the sample data
insert into temp1 values (1,sysdate);
insert into temp1 values (2,sysdate);
insert into temp1 values (3,add_months(sysdate,1));
insert into temp1 values (4,add_months(sysdate,1));
insert into temp1 values (5,add_months(sysdate,3));
insert into temp1 values (6,add_months(sysdate,5));
the table appears as follows
SRNO DT
1 22-JUN-12
2 22-JUN-12
3 22-JUL-12
4 22-JUL-12
5 22-SEP-12
6 22-NOV-12
To start with ADF View Object Creation (Using Jdeveloper 11.1.2):
Create the view object using Create View Object wizard
In Step 1. Name window
set the value for Name : Viewab (you can use any of ur choice)
In the data source section : select query
In Step 2. Query window
a. Click Query builder (it will pop up sql statment window)
b. In the SQL Statement window
in quick-pick objects section -> select temp1 table -> shuttle the columns from available list to selected list
in select clause section -> select srno column from select list-> choose count() function from function drop down list -> insert function -> set alias to REQUEST-> click validate
now select dt column from select list -> choose to_char() function -> click insert function -> alter the function to to_Char(temp1.DT,'Mon') -> set alias to Month -> click validate
in the group by clause section -> Click the green symbol to add -> from the expression palette insert dt column -> insert the to_char function -> alter the function to to_char(temp1.DT,'Mon') -> click validate
in the Entire SQL Query section -> click test query -> in the test query window -> click query result-> you will see the result -> click close -> click ok
Click next
Step 3: Bind Variables
Click Next
Step 4: Attribute Mappings
click Finish
So the view object is ready :) -
Error while using a VIEW with a FILTER - 0x80131904
Dear Colleagues,
I've a list and I want to use a view with a filter on a specific field.
[Attribution] is egal to [Me]
My Sharepoint 2013 keeps providing this error when I open the view filtered :
Exception from HRESULT: 0x80131904
Correlation ID:fc8650d8-5f52-4ceb-b819-0f784ec0318f
ULS shows the following :
01/07/2014 17:44:58.41 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Logging Correlation Data xmnv Medium Name=Request (GET:http://vspar-spfw-01:80/Lists/Conduite%20Changement/Requtes%20Attribues%20%20Moi.aspx) 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.42 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Logging Correlation Data xmnv Medium Site=/ 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.42 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (PostResolveRequestCacheHandler). Temps d’exécution=13,5726747393873 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Database d0d6 High System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value 'Benjamin RIOU' to data type int. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.HasMoreRows() at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordead... 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48* w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Database d0d6 High ...lock) 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation General xxpm High Unable to execute query: Error 0x80131904 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation General 8e2s Medium Unknown SPRequest error occurred. More information: 0x80131904 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Monitoring b4ly High Leaving Monitored Scope (EnsureListItemsData). Temps d’exécution=12,6535635115636 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Web Parts 89a1 High Error while executing web part: Microsoft.SharePoint.SPException: Exception from HRESULT: 0x80131904 ---> System.Runtime.InteropServices.COMException (0x80131904): Exception from HRESULT: 0x80131904 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListNa... 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48* w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Web Parts 89a1 High ...me, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) --- End of inner exception stack trace --- at Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx) at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCal... 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48* w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Web Parts 89a1 High ...lback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) at Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData() at Microsoft.SharePoint.SPListItemCollection.get_Count() at Microsoft.SharePoint.WebControls.SPDataSourceView.ExecuteSelect(DataSourceSelectArguments selectArguments, String aggregateString, Boolean wantReturn, BaseXsltListWebPart webpart, SPListItem& listItem, SPListItemCollection& listItems, String[]& fieldList) at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigatorInternal() at Microsoft.SharePoint.WebControls.SingleDataSource.GetXPathNavigator() at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Web Parts 89a2 High InnerException 1: System.Runtime.InteropServices.COMException (0x80131904): Exception from HRESULT: 0x80131904 at Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeArrayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) at Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback2(IListItemSqlClient pSqlClient, String bstrUrl, String bstrListName, String bstrViewName, String bstrViewXml, SAFEARRAYFLAGS fSafeArrayFlags, ISP2DSafeAr... 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.48* w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Web Parts 89a2 High ...rayWriter pSACallback, ISPDataCallback pPagingCallback, ISPDataCallback pPagingPrevCallback, ISPDataCallback pFilterLinkCallback, ISPDataCallback pSchemaCallback, ISPDataCallback pRowCountCallback, Boolean& pbMaximalView) 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
01/07/2014 17:44:58.50 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:http://vspar-spfw-01:80/Lists/Conduite%20Changement/Requtes%20Attribues%20%20Moi.aspx)). Temps d’exécution=95,5520883240747 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
The filtered field is a list of choices with no multiples values.
I'm pretty sure the issue is located here :
01/07/2014 17:44:58.48 w3wp.exe (0x21C0) 0x2AF4 SharePoint Foundation Database d0d6 High System.Data.SqlClient.SqlException: Conversion failed when converting the nvarchar value 'Benjamin RIOU' to data type int. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.HasMoreRows() at System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordead... 3d46579c-63c3-4dc9-bb9a-e7155e8da45a
What can I do ?
Thanks
Best regards / BenHi Ben,
How did you design the filter on the view?
This error usually occurred when people use SQL T-SQL. Here are two similar posts , please check whether they are useful for you:
http://social.technet.microsoft.com/Forums/en-US/e1ba76f9-855f-4087-91a7-c3e492e59be4/conversion-failed-when-converting-the-nvarchar-value-xxxxxx-to-data-type-int?forum=transactsql
http://social.technet.microsoft.com/Forums/en-US/1d0ab5f9-2ea6-4399-abbf-0c23b456e0f4/conversion-failed-when-converting-the-nvarchar-value-bottle-to-data-type-int?forum=transactsql
Please create a new list, and create a new view, then add a filter on the view, compare the result.
I hope this helps.
Thanks,
Wendy
Wendy Li
TechNet Community Support -
Query using Materalized view in oracle 9i and 10g
Hello
There are snapshots (materialized view) used in my application. We have recently migrated from 9i to 10g release 2 database.
After migration i have observed explain plan of query which is using materialized view and i found in 9i oracle treating materalized view as table. In 10g oracle is considerting it as MVIEW only (MAT_VIEW ACCESS BY INDEX ROWID). However in 10g cost of query which is using materialized view is much higher than 9i. And execution time is also random.
Can anbody pls. expalin diff. of materalized view access in oracle 9i and 10g.
Thankscan you post your query with explain plan for both 9i version and 10g version.
Thanks,
karthick. -
USE OF VIEWS IN OBIEE REPOSITORY
Hi Gurus,
What is the use of creating views in obiee physical layer.is it mandatory?
Could any one pls explain me.
THANKS,
SIVANo its not mandatory, its for quick fixes where you cant ETL your data into the structures you require, failing that you cant create a view in the underlying database because you dont have permissions, or its such a simple query you think it doesnt warrant creating.
Bear in mind :
All rows have to be returned from the view, the database has more work to do,
debugging your Physical SQL gets messy and quickly un-readable.
It really is for quick fixes but in the long term I'd always try and avoid them. -
Which is better External View OR Database procedure Proxy ?
Hi Jasmin and Kilian,
Creation of External View in HANA and consume in ABAP.
Which is better External View OR Database procedure Proxy.
Regards,
Pravin
Message was edited by: Jens Weiler
Branched from http://scn.sap.com/thread/3498161Hi Pravin,
that depends on your application logic and use case. There is no general recommendation for one or the other.
If, for instance, you have input parameters, you would go for a DB procedure proxy, since the external view does not allow to pass input parameters from the ABAP to the HANA column view.
On the other hand, if you would like to consume the result in an ALV with integrated data access (the "next generation ALV"), you would rather go for an external view... so - like the answer to so many other questions - it depends... .
Cheers,
Jasmin -
ADF: use of view link Accessor in Entity Object = always null?
Hi,
JClient 9.0.5.2, adf model.
I would like to use the view link accessor method in the master EO to retrieve detail EO values and the view link accessor method in the detail EO to retrieve master EO values.
Detail Rule:
In the detail EO an attribute is derived from an attribute of the master EO: detail attribute = master attribute.
Master Rule:
In the master EO an attribute is derived from the detail EO: master atribute set to 0 if detail EO exist else set to 0.
Tables:
Table Master => MasterEO => MasterVO
- masterPK (not updateable)
- masterField (not updateable)
- hasDetailsFlag
Table Detail => DetailEO => DetailVO
- detailPK (not updateable)
- masterPK => foreign key (not updateable)
- masterField (query only)
MasterDetailLink based on foreign key.
In link wizard I asked for the generation of following accessors in the source & destination Entity Objects:
In DetailEO accessor name: RetrieveFromMaster
In MasterEO accessor name: RetrieveFromDetail
In the DetailEO, I asked for the generation of the DetailEOImpl file, accessors and create method.
As wriiten in the file, before the create method:
** Add attribute defaulting logic in this method. **
I tought this is the place to retrieve the master attribute:
The code:
MasterVORowImpl masterVO = getRetrieveFromMaster();
if (masterVO == null)
System.out.println("MasterVORowImpl masterVO create NNNNNNNNNNNUUUUUUUULLLLLLLLLL");
The masterVO is always null?
I suppose I didn't understand something, my guest is that ViewObjects may not be used for default logic?
I know how to implement those rules in the database with triggers.
I think that the data I need for implementing those rules exist somewhere at the ADF level so retrieving the data from the db is not necessary?
Could somebody give some clues?
I didn't find a similar example in the Business Rules in BC4J document.
Your help will be appreciated
FredericHi,
Detail Rule, copy attribute value form master.
In DetailEOImpl:
protected void create(AttributeList attributeList)
setAttribute(MASTERFIELD,this.getMaster().getMasterField());
super.create(attributeList);
Master rule, set flag to 0 if no details else set to 1.
In the MasterEOImpl added method to check if detail row exists based on Row Iterator => no db retrieval?
This method also sets the flag accordingly:
protected void checkHasOtherDetails()
oracle.jbo.RowIterator ri = this.getRetrieveFromdetail();
ri.last();
// last() must be called else hasNext() returns true even on last delete ???
Number hasDetails = Constants.NUMBER_NO; // = 1
if (ri.hasNext() || ri.hasPrevious())
hasDetails = Constants.NUMBER_YES; // = 0
if (!getHasDetailsFlag().equals(hasDetails)) {
this.setHasDetailsFlag(hasDetails);
I call this method in the remove method of the detailEOImpl:
public void remove()
this.getRetrieeFromMaster().checkHasOtherDetails();
super.remove();
To set the flag I added follwoing code in the create method of the DetailEOImpl:
protected void create(AttributeList attributeList)
setAttribute(MASTERFIELD,this.getMaster().getMasterField());
**** ADDED ***
Number masterHasDetailsFlag = getRetrieveFromMaster().getHasDetailsFlag();
if (!masterHasDetailsFlag.equals(Constants.NUMBER_YES)) {
getRetrieveFromMaster().setHasDetailsFlag(Constants.NUMBER_YES));
super.create(attributeList);
One more question:
Is there a danger of calling last() on row iterators in create/update/remove methods of *Impl files?
=> current row changed => any effect on display in JPanel
Thanks
Frederic
PS All variable/method/class names have been manually renamed in this code so some small syntax problems may exist. -
Query DB2 tables from oracle using normal view
This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?
thanks,
vinodhVinodh2 wrote:
This is with regard to querying db2 tables using oracle views. The view is created using dblink. The querying is not an one time activity.querying will be done once in a day. Can i use normal view (will it work ) or should i use materialised view. will i be able to view the added records in db2 table using normal view?How can the SQL select statement via a dblink not work for a view, but the same SQL select statement work for a materialised view?
Do you think the database link or remote database care whether the select SQL that hits it, comes from a PL/SQL procedure, a view, a materialised view, a job or whatever else? It has no idea what/who is behind that select SQL - and nor does it care.
As for the benefits of a view vs. a materialised view - that depends on the requirements for needing to use that foreign database's data in the local database. -
Using DB2 views in crystal reports with java
Post Author: Shikha Tomar
CA Forum: JAVA
Hello,
We have used DB2 views in Crystal Report 11.
We are able to view the report through crystal report tool but while using this rpt file in java application,the DB2 view is not found.
It gives an error: "table SCDC.View_report not found."
SCDC.View_report=Name of the view used in rpt
Code for calling rpt is as below:
The line marked as red gives the error:
private static void switch_tables(DatabaseController databaseController) throws ReportSDKException, IOException {
final String URI = "!com.ibm.db2.jcc.DB2Driver!jdbc:db2://"SERVERNAME":"PORT"/"DATABASE_NAME"!"+"";
final String DATABASE_DLL = "crdb_jdbc.dll";
//Obtain collection of tables from this database controller.
Tables tables = databaseController.getDatabase().getTables();
CommandTable commandTable=new CommandTable();
//Set the datasource for all main report tables.
for (int i = 0; i < tables.size(); i++) {
ITable table = tables.getTable(i);
//Keep existing name and alias.
table.setName(table.getName());
table.setAlias(table.getAlias());
//Change properties that are different from the original datasource.
table.setQualifiedName(TABLE_NAME_QUALIFIER + table.getName());
//Change connection information properties.
IConnectionInfo connectionInfo = table.getConnectionInfo();
//Set new table connection property attributes.
PropertyBag propertyBag = new PropertyBag();
//Overwrite any existing properties with updated values.
propertyBag.put("Trusted_Connection", "false");
propertyBag.put("Server Name", SERVERNAME); //Optional property.
propertyBag.put("Connection String", CONNECTION_STRING);
propertyBag.put("Database Name", DATABASE_NAME);
propertyBag.put("Server Type", "JDBC (JNDI)");
propertyBag.put("URI", URI);
propertyBag.put("Use JDBC", "true");
propertyBag.put("Database DLL", DATABASE_DLL);
connectionInfo.setAttributes(propertyBag);
//Set database username and pasword.
//NOTE: Even if these the username and password properties don't change when switching databases, the
//database password is not saved in the report and must be set at runtime if the database is secured.
connectionInfo.setUserName(DBUSERNAME);
connectionInfo.setPassword(DBPASSWORD);
connectionInfo.setKind(ConnectionInfoKind.SQL);
//connectionInfo
table.setConnectionInfo(connectionInfo);
//Update old table in the report with the new table.
databaseController.setTableLocation(table, tables.getTable(i));
Regards,
ShikhaHi,
Fo business views please reffer to [Business Views Administrator's Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_bv_admin_en.pdf]
Yes, Crystal Reports 2008 can consume business views.
Regards,
Ramu.
Maybe you are looking for
-
BIP desktop vs BIP enterprise edition.
Hi, WHat is the difference between BIP Desktop and BIP Enterprise editon. I installed BIP Desktop first and coverted few Answers reports. I tried to sftp the report and was not successfull. I contacted oracle support and was informed that I need to i
-
Ipad2 data lost in PC when upgrade to 5.0
My iPad2 data where lost in my PC after upgrading with iTunes in my PC. Where to search in my PC ? Thanks.
-
HT5621 how do i sgin in to app store without a credit card
hey i just got a new mac book and i am tryig to log into the app store but it is asking me for credit card information, but i am not planning on purchasing apps as i do not have a credit card. anything i can do?
-
Secured server with SSH and VPN?
Hi, Have an Archbox at home and when I'm traveling I would like to connect to my Archlinux box at home to grab files and such things. Using ADSL with a static IP and a D-Link router. If I create a portfowarding rule of port 443 to my Archlinux box an
-
Can I do this ...? VOIP Modem/router > switch > Airport Extreme (on first floor) then Airport Express with an ethernet VOIP handset plugged into the ethernet ports on the airport express (on the second floor)? does the ethernet port on AExpress suppl