Query referencing session state not consistently returning data
Hi,
I have a form that summarizes expense data by category for employees, per fiscal year, fiscal period, and project.
Clicking on a button next to a particular category takes the user to a new page that should display the detail of those expenses, based on expense_code.
The expense_code is passed via URL to the second page, and the query region for the detail has the following source:
select exp_code, JRNL_ID_NO, DESCRIPTION, REFERENCE, CUR_PER_TRAN, CUM_YTD
from fgspec_ac where exp_code between :P118_EXPENSE_CODE_FROM and :P118_EXPENSE_CODE_TO and project=:P114_PROJECT and fis_year=:P114_FIS_YEAR and fis_period=:P114_FIS_PERIOD
:P118_EXPENSE_CODE_FROM and :P118_EXPENSE_CODE_TO are passed via URL, and the :P114_% fields reference data on the initial form.
The problem is that when I click on the button to bring up the detail for the first time, the query returns no rows. If I return to the original form and click on the button a second time, the query the displays the required data. This behavior is consistent, regardless of expense category, fiscal period, etc. The first time I try to access detail, no records returned, but the second time, it works.
I have used the 'SESSION' link to debug and view the session state in each case, and the results are IDENTICAL whether the query returns data or not. That is, all 5 variables contain the exact same data.
Do you know what I might be doing wrong?
Thanks,
Michelle
Hi guys,
Thanks very much for your replies. In fact, I have tried both methods. Yes, I am navigating from page 114 to 118, and passing values to page 118 from page 114 (ie: P114_PROJECT passes to P118_PROJECT, etc...). In my query, I have tried referencing both, with the same results.
When checking values in session state (by using the 'SESSION' link), values from page 114 are available in both cases (when the query returns rows and when it does not). It is very strange behavior.
I have been developing with HTMLDB for over a year now, and never seen anything like it!!! I will try loading this on HTMLDB.oracle.com, and see if it replicates, and if so, maybe you can have a look...............
Thanks!
Michelle
Similar Messages
-
SQL statement doesn't return data
Hi,
Please I am facing a problem where I took the sql statement from an oracle report and I'm applying it on TOAD 9.0 but it is not returning any data. The thing is that on the application the report returns data but as I checked on the TOAD it showed that some tables have no data.
How is this possible??
Do I need to apply some code before I apply my select statement??
Hope you can help here,
Thanks in Advance,
AshrafHi Ashraf,
As it should be if a Query in Report is returning data so should the same query return data if used either in Toad or SQL Plus.
In your report do check if you have any parameters and do this parameters have any default values and are you using the same parameters.
Also do check the source of the Report which the application is executing and the one from where you are using the Query is same.
Best Regards
Arif Khadas -
Referencing session state across DBLinks
I have a central security package that all applications access to provide item-level authorisation.
Recent extensions to the security model require additional information from the application, held in Application Items.
For various legacy reasons I want to avoid having to add additional parameters to the security functions called so I reference the application items via the V() function. This works perfectly on local applications (within the same database) but V() returns null values if the application is accessing the security function via a DB link.
So, is there any way to access session state from a PL/SQL package of an application that is not running on the same database?
Regards
RichardRichard
Something along these lines might work. Say the remote package is named 'sec var'. At the remote db create 'sec_vas' as follows. create or replace package sec_vars is
var1 varchar2(100); // new items needed by auth fn
var2 varchar2(100);
procedure setval (var1 in varchar2,var2 in varchar2); //sets var1/var2 with values from session state
function getval (var in varchar2) return varchar2; // the local 'v' fn
function doAuth() return boolean;
end;
create or replace package body sec_vars is
procedure setval (var1 in varchar2,var2 in varchar2) is
begin
sec_vars.var1:='Variable 1';
sec_vars.var2 := 'variable 2';
end;
function getval (var in varchar2) return varchar2 is
begin
if upper(var)='VAR1' then
return sec_vars.var1;
elsif upper(var)='VAR2' then
return sec_vars.var2;
else
return null;
end if;
end;
function doAuth() return boolean is
begin
select count(*) from emp where ename=sec_vars.get_val('VAR1'');
return true;
end;
end;And in the Apex db we do something like create synonym sec_vars for sec_vars@remote_db;
// an auth process
begin
sec_vars.setval ('Variable 1','variable 2'); // set required session item values
sec_vars.do_auth();
end;varad -
Items in session state not behaving as expected
And again...
(I hope I'm not asking too much, posting 2 new questions in under 5 min....)
This is something new I experienced: I need to show the value of an item (P210_EXTERNAL_ID) on a page (P215)
... not a big thing I thought... BUT when I tried to do this I hit the ground pretty rough (I thought I had actually gained some knowledge about html-db.)
My problem is that I pass on a lot of values from P200 (the report) to P215 (the form) and I reached the limit of characters, that can be used to specify the link (to P215).
So I thought to myself: Well, lets do it different!
I tried:
- specifying a default for the item on P215: P215_EXTERNAL_ID,
- specifying the source for P215_EXTERNAL_ID,
- creating a computation on P215_EXTERNAL_ID,
- filling P215_EXTERNAL_ID 'manually' with a process...
none of these did play the trick for me.
(By the way, I used both syntaxes to reference :P210_EXTERNAL_ID and &P210_EXTERNAL_ID.)
I used Display as Text (saves state) for the item on P215: P215_EXTERNAL_ID,
the item on P210: P210_EXTERNAL_ID is a Text Field.
The unexpected thing I experienced, was that the Item on P215 stayed empty or lagged behind:
- visit P210 with P210_EXTERNAL_ID = 1234
--- branch to P215 (P215_EXTERNAL_ID is empty)
- revisit P210 with P210_EXTERNAL_ID = 5
--- branch to P215 (P215_EXTERNAL_ID = 1234)
- revisit P210 with P210_EXTERNAL_ID = 66
--- branch to P215 (P215_EXTERNAL_ID = 5)
After realizing this I took a look at the session (with the link at the bottom of each page).
And in the Session State the value of P210_EXTERNAL_ID was the old value (always one behind)!!!
Has anybody ever seen something like this??
I'm really running out of ideas here.
-David-Bill,
Usually I use the pass-on-only-the-PK method too, but here I built something like a consolidated view on a table: one row in the report doesn't correspond to one row in the table, but a group of rows, that are located in the same freezer, same shelf, same rack and same box. So the PK woun't work here b/c I don't have one in the first place... But the thing with referencing other pages items might do the trick to bring down the number of other values I pass on.
Another thought with the example:
- visit P210 with P210_EXTERNAL_ID = 1234
--- branch to P215 (P215_EXTERNAL_ID is empty)
- revisit P210 with P210_EXTERNAL_ID = 5
--- branch to P215 (P215_EXTERNAL_ID = 1234)
- revisit P210 with P210_EXTERNAL_ID = 66
--- branch to P215 (P215_EXTERNAL_ID = 5)
When I click on the edit button on P210 to go to P215, is the page P210 not submitted?
If that's the case, I understand why P210_EXTERNAL_ID in Session State has the last, but not the current value.... Since I branche off that page before submit, the items current values are not written to session state.
Anyone any thoughts to that???
-David- -
Different ways to referencing Session State variables
Hi,
According to APEX documentation there's 4 different ways to reference session state variables: http://download-west.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32471/concept.htm#BEICHBBG
In an inline PL/SQL statement, what's the difference when using the different methods? I remember reading something that the bind and static text have a size restrictions. What's the difference between the V() and NV() functions?
Thank you.
MartinMartin,
In PL/SQL, the preferable method is to use bind variable notation, e.g., :P1_ITEM. In HTML contexts, you must use &ITEM. notation. In stored procedures, you can use v or nv, the latter function being identical to the former with the additional characteristic that it raises an exception if the retrieved value is non-numeric.
Scott -
Session state variables across multiple ApEx applications
We have a suite of loosely integrate ApEx applications that all share a common authentication scheme. When you first log in we attempt to load a series of session state variables with temporary data to streamline various logging and authentication related activities for the life of the session.
However, these session variables seem to disappear when you move from one application to another, so they are not truly tied to just the "session" which carries over across all applications, but the application from which the session state is set.
What is the suggested way, keeping in mind that the data being held may have security related context, to preserve values during a session, but regardless of which ApEx application you are in.
The method we are using to share the authentication is using a common "Cookie Name" from a common subscribed authentication scheme as suggested elsewhere on this site and seems to work very well outside of this specific issue.
Thanks in advance,
BarneyApologies for the delay getting back on this.
My use of the word "disappear" was probably misleading. They were not visible from the second application. When setting "Session State" I was under the impression that it was setting it for the authenticated session, not for the specific application. (I am referring to the: apex_util.set/get_session_state).
Your solution will work fine, as long as I know which application the user last authenticated against. However, it could be one of over 30 (and growing) different applications which would require me writing a program to go through every "p_flow" to try and find a valid value every time I need to reference the field.
It would be really beneficial if you could store true Session variables which stay alive for the life of the authenticated session and is available to anything authenticated against that session id. This would streamline alot of cross-application program development.
The "get/set_session_state" is a misleading as it is not a Session value, but an Application value. The Session exists across multiple applications, while this procedure does not.
Thanks,
Barney -
How to reference session state in a list entry label
You can use &<item>. to reference session state values which can then be used in titles and item labels but it seems it does not work in the label for a list entry (i.e. to build a menu). Is there a workaround?
thanks in advance
PaulPOK I just realized that referencing session state doesn't work for lists used by Enkitec's NavBar plugin solution. It does reference the &<ITEM>. correctly for normal APEX lists. Anyone know how to reference session state when using Enkitec's NavBar plugin solution?
PaulP -
Select statement failed to get data from transparent table
Hi Experts,
Please let me know why my select statement is failing to get data form transparent table REGUH. My code query is as below:
SELECT * FROM REGUH WHERE
LAUFD = RUN_DATE AND
LAUFI = ID AND
LIFNR = P0009-PERNR AND
RZAWE = 'C'.
MOVE REGUH-RWBTR TO CASH.
CASH = CASH * -1.
ENDSELECT.
REGUH table has data for the given query but it is not retreiving the data.Please let me know what is the problem with the query
because of which it is not fetching the data.The same query is working fine in Developement but fails in production may be because one new patch is updated.please help asap.Hi Ankita,
Why you are going for select *
Try This...
SELECT SINGLE RWBTR
INTO v_RWBTR
WHERE LAUFD = RUN_DATE
AND LAUFI = ID
AND LIFNR = P0009-PERNR
AND RZAWE = 'C'.
MOVE v_RWBTR TO CASH.
CASH = CASH * -1.
Regards,
Raj. -
Sys_refcursor not fetching any data although query returns value
hi!!!
I am using sys_refcursor to return columns,and using below procedure to do so.Although data is there in table_1 and table_2.
PROCEDURE test_pro(abc_date N DATE,
cur_get_data OUT sys_refcursor
OPEN cur_get_data
for
select A.col1,B.col2
from table_1 A
where A.dis_date=abc_date
left outer join
table_2 B
on
A.dis_date=B.dis_date;
IF cur_get_data%rowcount=0
then
raise e_error;
END if;
EXCEPTION
when e_error
then
------no_data_found;
when others
then
--------(giving SQL error with error code);
END test_pro;
while running below sql in sql window of pl/sql developer fetching
data
select A.col1,B.col2
from table_1 A
where A.dis_date=abc_date
left outer join
table_2 B
on
A.dis_date=B.dis_date;
but while testing the test_pro in test window of pl/sql developer it is
not fetching any data and raising e_error each time
is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
so can somebody please put some ideas what cud be the possible reason for this??Welcome to the forum!
Unfortunatley you posted to the wrong forum. This question belongs in the SQL and PL/SQL forum.
PL/SQL
>
sys_refcursor not fetching any data although query returns value
but while testing the test_pro in test window of pl/sql developer it is
not fetching any data and raising e_error each time
is there any problem arising using IF cur_get_data%rowcount=0 as each time it is going to exception block..
>
A cursor doesn't fetch data - your code has to do that. The code you posted doesn't have any FETCH statements so no data will be fetched.
There is no problem using 'IF cur_get_data%rowcount=0' but it will always be 0 in your code because you are not fetching any data.
I'm guessing that you are trying to determine if there are any rows for the query. That isn't going to work since a cursor doesn't fetch rows.
You just have to return the cursor to the caller and the caller will have to perform at least one fetch to see if there are any rows.
If the above answers your question the just mark the question ANSWERED. Otherwise, since you have posted in the wrong forum
1. repost the question in the SQL and PL/SQL forum
2. Edit this post to add a link to the new thread in the other forum
3. Mark this question ANSWERED so people will follow up in the other forum.
Thanks. -
Return Data from query, but not in datagrid.
Using Flex Builder 2 and ColdFusion, does anyone have advice
or examples of running a query to database and returning the
results for display in something other than datagrid? I need more
control over where my returned data is displaying on my
forms.Hi!
By using HTTPService class (see
http://livedocs.adobe.com/flex/201/langref/mx/rpc/http/mxml/HTTPService.html)
you can execute a db query script which will send the data to flex.
The data can be any of object|array|xml|e4x|flashvars|text formats.
You can them handle it however you want to populate whatever
flex objet.
Does this help ? -
Query for future dates returning data
Hi,
I am not sure why this is happening. I ran the following query in 3 separate databases supporting 3 diff applications on various tables. Some tables return data the others dont. I picked the tables randomly.
The column 'createdt' stores the date on which the row was inserted.
select * from <tablename> where to_char(createdt,'mm/dd/yyyy') between '01/04/2012' and '03/08/2012'; when the query is changed to:
select * from <tablename> where to_char(createdt,'yyyy') between '2012' and '2013';It consistently returns no data, as it should.
Anyone knows why this is happening?
Thanks.This statement:
select * from <tablename> where to_char(createdt,'mm/dd/yyyy') between '01/04/2012' and '03/08/2012';uses alphabetical comparison. '02/12/2005' is between those two strings. In fact '02/<anything>' is between those two strings ;-)
Use date comparison rather than string comparison:
select * from <tablename>
where createdt >= to_date('01/04/2012','mm/dd/yyyy')
and createdt < to_date('03/08/2012','mm/dd/yyyy') + 1;(The createdt < to_date('03/08/2012','mm/dd/yyyy') + 1 is to make sure to get all of august 3rd, no matter what time it was ;-) ) -
Query in ASWE XML code doesn't return data
Hello, since people on the Oracle Metalink site are to lazy to give an answer to this question. I'll try it via this forum. Here we go:
I'm developing wireless applications running on Oracle9i Application Server Wireless Edition. I'v tried to implement the employee sample from Oracle Online Mobile Studio (studio.oraclemobile.com). The sample name is employee.jsp. This sample combines XML code with JSP.
(code at the end of the text)
When I test the sample I get no query results.
When you take the first option for example, (search by dept number) the query result will not be displayed. I think it has something to do with the "executeQuery" line.
rset = stmt.executeQuery("select * from EMP where EMPNO='" + empNum + "'");
After giving the following input (employeenumber) 7369 (which excists in the
database). I get the following errors:
The panama server log returns the following error:
1/14/02 5:19:28 PM NOTIFY : [Thread-13]
core.XSLTransformerImpl.getXSLProc(XSLTransformerImpl.java:120)
Create 10 number of XSL-processor for TINY_HTML
1/14/02 5:19:35 PM NOTIFY : [Thread-15]
adapter.URLAdapter.invoke(URLAdapter.java:240)
URL = http://host/portal/test/employee.jsp
1/14/02 5:19:37 PM NOTIFY : [Thread-17] adapter.URLAdapter.invoke(URLAdapter.java:240)
URL =http://host/portal/test/employee.jsp?choice=empNum
1/14/02 5:19:49 PM NOTIFY : [Thread-19]adapter.URLAdapter.invoke(URLAdapter.java:240)
URL =http://host/portal/test/employee.jsp?&empNum=7369
1/14/02 5:19:50 PM ERROR : [Thread-19]rt.common.Controller.reportServiceInvocationError(Controller.java:707)
Service Invocation Error: Stream closed.
The jserv.log returns the following error:
[14/01/2002 17:19:50:431 CET] Invalid column name
java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:4383)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:667)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1374)
at portal.test._employee._jspService(_employee.java:201)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java)
at oracle.jsp.JspServlet.internalService(JspServlet.java)
at oracle.jsp.JspServlet.service(JspServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:402)
at org.apache.jserv.JServConnection.run(JServConnection.java:260)
at java.lang.Thread.run(Thread.java:479)
Does this have something to do with the encoding of the query result in the select statement? As you can see the variable is in the requeststring (URL = http://host/portal/test/employee.jsp?&empNum=7369)
My database connection works fine (I've also tested the query using SQL plus and the SQL adapter also works).
Is this the right statement?: ("select * from EMP where EMPNO='" + empNum + "'");
I can not do anything with the error in the jserv.log (java.sql.SQLException: Invalid column name).
The columnname EMPNO excists in the example table. The query in SQL plus gives a result.
Can someone give my any suggestions?
Thanks in advance.
Thomas Wesseling, UCC
### Code of employee.jsp ###
<?xml version="1.0" encoding="UTF-8"?>
<SimpleResult>
<SimpleContainer>
<%@ page language="java" import="java.sql.*, java.util.*, java.text.* "%>
<%
//URL variables
String choice = request.getParameter("choice");
String empNum = request.getParameter("empNum");
String lastName = request.getParameter("lastName");
String jobTitle = request.getParameter("jobTitle");
String deptNum = request.getParameter("deptNum");
String notFoundMsg = null; //String for containing varying not found msg
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@172.16.0.51:1521:ora816", "scott", "tiger");
Statement stmt = conn.createStatement();
ResultSet rset = null;
//**** Start of service - first card ****
if (choice==null && empNum==null && lastName==null &&
jobTitle==null && deptNum==null)
%>
<SimpleMenu title="Employee Search by:">
<SimpleMenuItem target="employee.jsp?choice=empNum">Employee Number</SimpleMenuItem>
<SimpleMenuItem target="employee.jsp?choice=lastName">Name</SimpleMenuItem>
<SimpleMenuItem target="employee.jsp?choice=jobTitle">Job Title</SimpleMenuItem>
<SimpleMenuItem target="employee.jsp?choice=deptNum">Dept Number</SimpleMenuItem>
</SimpleMenu>
<%
//**** SECOND CARD - which search criteria ****
if (choice!=null)
if (choice.equals("empNum") && empNum == null)
%>
<!-- show search by employee number -->
<SimpleForm target="employee.jsp?">
<SimpleFormItem name="empNum" format="*N">Enter Employee Number: </SimpleFormItem>
</SimpleForm>
<%
else if (choice.equals("lastName") && lastName == null)
%>
<!-- show search by last name -->
<SimpleForm target="employee.jsp?">
<SimpleFormItem name="lastName" format="*A">Enter Last Name: </SimpleFormItem>
</SimpleForm>
<%
else if (choice.equals("jobTitle") && jobTitle == null)
%>
<!-- show search by job title -->
<SimpleForm target="employee.jsp?">
<SimpleFormSelect name="jobTitle" title="Enter Job Title:">
<SimpleFormOption value="CLERK">Clerk</SimpleFormOption>
<SimpleFormOption value="SALESMAN">Salesman</SimpleFormOption>
<SimpleFormOption value="MANAGER">Manager</SimpleFormOption>
<SimpleFormOption value="ANALYST">Analyst</SimpleFormOption>
<SimpleFormOption value="PRESIDENT">President</SimpleFormOption>
</SimpleFormSelect>
</SimpleForm>
<%
else if (choice.equals("deptNum") && deptNum == null)
%>
<!-- show search by dept number -->
<SimpleForm target="employee.jsp?">
<SimpleFormItem name="deptNum" format="*N">Enter Dept Number: </SimpleFormItem>
</SimpleForm>
<%
//**** THIRD CARD - query DB based on criteria ****
//**** empNum entered as search criteria ****
if (empNum != null) //empNum is entered as search criteria- NEED TO TEST FOR NON-int
rset = stmt.executeQuery("select * from EMP where EMPNO='" + empNum + "'");
if (rset.next()) //if rset returns data, show data
do {
%>
<%@ include file="showResult.jsp" %>
<%
} while (rset.next());
} //end rset.next() is true
else
notFoundMsg = "Employee Number " + empNum + " Not Found";
%>
<%@ include file="notFound.jsp" %>
<% }
} //end if empNum != null
//**** lastName as search criteria ****
else if (lastName != null)
rset = stmt.executeQuery("select * from EMP where ENAME='" + lastName + "'");
if (rset.next())
do {
%>
<%@ include file="showResult.jsp" %>
<%
} while (rset.next());
} //end rset.next is true
else
notFoundMsg = "Name " + lastName + " Not Found";
%>
<%@ include file="notFound.jsp" %>
<% }
} //end if lastName != null
//**** jobTitle as search criteria ****
else if (jobTitle != null)
rset = stmt.executeQuery("select * from EMP where JOB='" + jobTitle + "'");
if (rset.next())
do {
%>
<%@ include file="showResult.jsp" %>
<%
} while (rset.next());
} //end rset.next is true
else
notFoundMsg = "Job Title " + jobTitle + " Not Found";
%>
<%@ include file="notFound.jsp" %>
<% }
} //end if jobTitle != null
//**** deptNum as search criteria ****
else if (deptNum != null) //deptNum is entered as search criteria
rset = stmt.executeQuery("select * from EMP where DEPTNO='" + deptNum + "'");
if (rset.next())
do {
%>
<%@ include file="showResult.jsp" %>
<%
} while (rset.next());
else
notFoundMsg = "Dept Number " + deptNum + " Not Found";
%>
<%@ include file="notFound.jsp" %>
<% }
} //end if deptNum != null
conn.close();
%>
</SimpleContainer>
</SimpleResult>
### Code of NotFound.jsp ###
<SimpleText>
<SimpleTextItem><%=notFoundMsg%></SimpleTextItem>
<Action label="Search" type="ACCEPT" task="GO" target="employee.jsp?"></Action>
</SimpleText>
### Code of ShowResult.jsp ###
<%
//format date from query
java.sql.Date date = rset.getDate("HIREDATE");
String hireDate = DateFormat.getDateInstance(DateFormat.MEDIUM).format(date);
%>
<SimpleText>
<SimpleTextItem>Emp#: <%=rset.getString("EMPNO")%></SimpleTextItem>
<SimpleTextItem>Name: <%=rset.getString("ENAME")%></SimpleTextItem>
<SimpleTextItem>Job: <%=rset.getString("JOB")%></SimpleTextItem>
<SimpleTextItem>Manager: <%=rset.getString("MGR")%></SimpleTextItem>
<SimpleTextItem>Hire Date: <%=hireDate %></SimpleTextItem>
<SimpleTextItem>Salary: <%=rset.getString("SAL")%></SimpleTextItem>
<SimpleTextItem>Commission: <%=rset.getString("COMM")%></SimpleTextItem>
<SimpleTextItem>Dept#: <%=rset.getString("DEPTNO")%></SimpleTextItem>
<SimpleTextItem>Email: <%=rset.getString("EMAIL")%></SimpleTextItem>
<SimpleTextItem>Phone: <%=rset.getString("PHONE")%></SimpleTextItem>
<Action label="Search" type="SOFT1" task="GO" target="employee.jsp"></Action>
<Action label="Call" type="OPTIONS" task="CALL" number="<%=rset.getString("PHONE")%>"></Action>
</SimpleText>Is EMPNO really a string field and not a numeric field? Your query is like
... where EMPNO='1949'
and should it perhaps be
... where EMPNO=1949
? -
Query is returning data very slowly
Hi,
Please advise for the solution. Thanks in advance.
The problem is that the queries returning data very very slow.
Let me explain further, There is one major table that is storing master data (Main Transaction) and its detail data (Child Records) and further detail of the detail data (Child Records of the Child Records) and so on sometimes upto 5 or 6 levels in the same ONE big table called "TRANSACTIONS_TABLE" table.
Therefore, mostly my quries are self joins like
SELECT /*+ FIRST_ROWS(10) */ JUDG.ID JUDG_ID,
SE.ID SE_ID,
CS.ID CS_ID,
CS.CS_DATE,
CS.CS_J_ID,
CS.CT_ID,
C.ID C_ID,
C.TRANSACTIOIN_TYPE_ID C_TRANSACTIOIN_TYPE_ID,
C.TRANSACTIOIN_NO,
C.TRANSACTIOIN_YEAR,
C.TRANSACTIOIN_DATE,
C.SUBJECT,
C.UNIT_ID,
(SELECT U.NAME_N FROM ORG U WHERE U.ID = C.UNIT_ID) PRC_UNIT_DESC,
C.E4 NO_AL_QAZYA_ID,
SELECT T.DESCRIPTION
FROM prc_charge_categories T
WHERE T.ID = TO_NUMBER(C.E4)
) NO_AL_QAZYA,
C.CREATED_BY
FROM TRANSACTIOINSACTION_TABLE C,TRANSACTIOINSACTION_TABLE SE, TRANSACTIOINSACTION_TABLE JUDG, DEF_TABLE CS
WHERE C.ID = SE.PARENT_ID
AND SE.ID = J.PARENT_ID
AND SE.TRANSACTIOIN_TYPE_ID = 63755
AND J.TRANSACTIOIN_TYPE_ID = 63424
AND J.E1 = '3'
AND CS.ID = TO_NUMBER(SE.E9);
23 rows selected in 48.672 seconds
I run the below query on this table
select transaction_type_id,count(*) total_rows
from transactions_table
group by transaction_type_id
order by 2 desc;
transact total_rows
114893 1192544
63755 774132
62270 682361
63424 633046
65220 515605
67728 457831
84928 378754
58806 296351
64240 277624
65244 275267
67224 152061
112610 123796
67434 116100
65824 88787
61369 76196
62269 74821
61740 67085
56448 56185
65703 55336
99601 54552
64423 49368
61478 43187
101689 39372
61652 38196
67136 27713
61364 25790
97961 23610
65380 19811
56353 18910
65618 18309
57041 16808
98137 15837
101794 14618
100127 14118
98916 13691
112735 13082
117349 11930
69334 11462
99064 10291
67811 10151
69402 9142
112753 8243
95950 7390
68902 6900
119474 6693
65659 5972
68360 5862
66198 5690
118340 5161
62012 4490
71088 4050
112040 3864
57315 3047
112031 2957
57289 2891
112039 2523
112038 2446
114254 2269
55550 2242
119926 2225
69650 2135
65033 1343
119078 811
69788 780
115133 774
116390 578
114968 549
65575 521
64290 412
120026 403
67388 359
116340 249
66847 228
98524 144
68214 138
120459 105
118777 92
79395 87
116039 79
65768 67
118376 58
120906 57
55848 52
58983 50
61195 48
68134 29
66645 24
55992 23
69037 21
70379 21
56674 20
112019 20
68911 18
70206 17
66028 16
114335 11
69555 7
55849 6
57122 6
65034 5
60496 5
57273 4
56286 4
55563 4
56972 3
55542 3
70654 3
55999 3
56721 3
57138 2
117802 2
57005 2
61058 2
116351 2
57096 2
57075 2
95136 1
115210 1
117601 1
68298 1
56939 1
65935 1
61739 1
65611 1
71249 1
57010 1
95024 1
68406 1
57097 1
122206 1
57062 1
132 rows selected in 5.266 seconds
Immediately, I again run this same query
132 rows selected in 5.079 seconds
then again
132 rows selected in 2.672 seconds
then again
132 rows selected in 4.438 seconds
then again
132 rows selected in 2.684 seconds
The structure of this table is
CREATE TABLE transactions_table
ID NUMBER NOT NULL,
PARENT_ID NUMBER,
TRANSACTION_TYPE_ID NUMBER NOT NULL,
TRANSACTION_YEAR NUMBER(4),
TRANSACTION_NO NUMBER(8),
TRANSACTION_DATE DATE NOT NULL,
C1 VARCHAR2(255 BYTE),
C2 VARCHAR2(255 BYTE),
C3 VARCHAR2(255 BYTE),
LONG_C1 VARCHAR2(4000 BYTE),
LONG_C2 VARCHAR2(4000 BYTE),
LONG_C3 VARCHAR2(4000 BYTE)
TABLESPACE TS16K_DATA
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 3144M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE UNIQUE INDEX MOJ.EVN_PK_I ON transactions_table
(ID)
NOLOGGING
TABLESPACE TS16K_INDX
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 168M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
CREATE INDEX EVN_EVN_TYP_I ON transactions_table
(TRANSACTION_TYPE_ID)
NOLOGGING
TABLESPACE TS16K_INDX
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 136M
MINEXTENTS 1
MAXEXTENTS UNLIMITED
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
There are 150 COLUMNS in this table and out of which there are 33 columns data type is VARCHAR2(4000 BYTE) and others NUMBER datatype and some are VARCHAR2(255 BYTE)
As from above, the index on TRANSACTION_TYPE_ID is not unique and not bit map but a normal index.
Further there are no partitions for this table.
Many of the database views based on this table return results after several minutes.
* Around 5000 to 8000 rows are entered in this table on daily basis and is it feasible to create partitions and modify indexes to bit map and vice versa where ever required because already this table is having 54 Indexes including composite ones.
Please help and advise.When your query takes too long ...
HOW TO: Post a SQL statement tuning request - template posting -
Publisher11g - no return data with a data model from logical query
Hi, i am usign publisher11g with obiee bi server autenthication.
On rpd i define a security model with a user variable, a initialization block and a where over one fact table.
When i create a answer report, bi server automatically include on the wher something like this: where user = 'name'.
Well, when i create a publisher report and try to view data from this fact table, return no data.
If i create a data model only with a dimension table, not over automatic where from bi server, the report return data.
View the log nqquery, i see that the generate query include where user ='', not include the value of a session variable.
Any idea?
Thanks.I do have one question, is the member Balancesheet already in the outline?
Yes
**Measure
Balance Sheet
Profit and Loss**
Also in the load rule did you change the dimension load settings for the accounts dimension to be parent/child for the accounts dimension.
Field Properties -> Dimension Build Properites
Dimension=
Field 1 Measure; Type = Parent
Field 2 Measure; Type = Child
Field 2 Measure; Type = Alais
OK
Quite often people don't realize they have to double click on the dimension name to make sure it gets put as the dimension that gets changed.
I'm pretty sure your issue is it is trying to do the data load and not the dim build,but that could just be the first problem
**Click on Dimension Build Field
Click on Dimension Build setting
Dimension = Measure; Build Method; = Parent/ Child**
Please advise -
Session state is not being passed properly to another page
Hello Gurus,
I have a multi-page application which authenticates using a simple authentication page 101. Right now I have a generic authentication scheme which always returns true (Session Verify Function= return true; I will integrate LDAP later.) It works fine. The app remembers the username from one page to the next (popup pages mainly).
My issue is that, after exporting the application and re-importing into a new workspace, the user/session state is no longer being preserved from page to page. It prompts for a login every new page that is opened (the popups). This ruins the flow and functionality of the app.
I've checked every setting (I think) and cannot find any differences between the two workspaces or apps. Any ideas why this would work in one workspace and not the other?
TIA!
Jonathan
I should also indicate that the issue seems to be specifically in calling "callmypopup" function. For some reason it isn't passing the session id properly to the popup page, where it did fine in the other workspace. function text:
function callMyPopup (sourceItem, popuppagenum, targetItem, appid, appsession) {
//opens popup pg and passes value in sourceItem to targetItem
//sourceitem=calling text box, targetItem=text box in popup page
var minlength = 3;
if (CheckLength(sourceItem, minlength))
var formVal1 = document.getElementById(sourceItem).value.toUpperCase();
var url;
url = 'f?p=' + appid + ':' + popuppagenum + ':' + appsession + '::::' + targetItem + ':' + formVal1;
w = open(url,"winLov","Scrollbars=1,resizable=1,width=800,height=600");
if (w.opener == null)
w.opener = self;
w.focus();
else {alert('Please enter at least ' + minlength + ' characters in your search.');}
Edited by: austindurant on Sep 5, 2008 7:02 AM
Edited by: austindurant on Sep 5, 2008 7:46 AMIt looks like your session id is not correctly passed to your popup page. Try using:
javascript:popUp2('f?p=&APP_ID.:1:&SESSION.:::::', 600, 700);
instead, which does the same thing. Put your parameters for the page items there if required.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
Maybe you are looking for
-
Currency Translation not working with "Time Reference from Variable"
We have created several Currency Translations using RSCUR with a fixed "Key Date". All have been working fine until we got the request to allow a variable date for the exchange rate date. I have built a variable on 0DATE which I am putting a defaul
-
Icons in alv report....
Hi all, I am creating an ALV report using oops concept all the things are working fine but i can not able to see all the icons enabled (icon for sum and and the next to that both are disabled) plz give the solution ASAP.... Thanks and Regards Ashu
-
How to change the Data Foundation for an existing Business Element
My Issue: I have quite a few reports that use the same Business View. The Business View has an under lying Data Foundation that uses a Dynamic Data Connection (DDC). I no longer want to use this DDC because production users are complaining they do no
-
Carrier Code in Customs Declaration
Hello, Where must the Carrier Code be stored in the Customs Declaration so that it prints out on the U.S. import forms 3461 and 7501?
-
How can I consume a A2x service that is already modelled in MDRS using the WSDL file in SOAP UI. WSDL looks to be incomplete in terms of Location tag