Tunning sql queries reg
Hi all,
can anybody explained what are the basic steps to tune this query,since i am unaware of tunning concept.need ur suggestion kindly
Select DECODE(r.PriorityCode,2,1,2) priority,
NVL(p.CUSTOMERPRIORITYCODE,3) CUSTOMERPRIORITYCODE,
qpp.managerID managerID,
qpp.priority queuePriority,
r.lastModDate lastModDate,
r.requestID requestID,
r.miniTeamID miniTeamID
From SRequest r, Person P, QueuePersonPref qpp, Auto_MiniTeam am
Where r.requestTypeCode = 1
And r.statusCode = 1
And r.assigned_PersonID Is Not Null
And r.miniTeamID In (
Select childMiniTeamID
From MiniTeamTree
Where childMiniTeamID = r.miniTeamID
And parentMiniTeamID = qpp.MiniteamID
And levelFromParent = 1
And r.lastModDate < (l_sysDate - 8/24)
And NVL(r.customerPersonID,24497) = p.personID (+)
And am.miniTeamID = qpp.miniTeamID
And qpp.personID = SonarSession.sPersonID
And exists ( Select 1 From ERPerson er
Where er.personID = SonarSession.spersonID
And er.miniTeamID = r.miniTeamID
And er.securityLevelCode in (5, 7, 8)
And r.requestID Not IN (Select requestID From QueueRequest_TMP)
UNION
-- Second set
Select DECODE(r.PriorityCode,2,1,2) priority,
NVL(p.CUSTOMERPRIORITYCODE,3) CUSTOMERPRIORITYCODE,
qpp.managerID managerID,
qpp.priority queuePriority,
r.lastModDate lastModDate,
r.requestID requestID,
r.miniTeamID miniTeamID
From SRequest r, Person P, QueuePersonPref qpp, Auto_MiniTeam am
Where r.requestTypeCode = 1
And r.statusCode In (2, 3)
And r.assigned_PersonID Is Null
And r.miniTeamID In (
Select childMiniTeamID
From MiniTeamTree
Where childMiniTeamID = r.miniTeamID
And parentMiniTeamID = qpp.MiniteamID
And levelFromParent = 1
And r.lastModDate < (l_sysDate - 1)
And NVL(r.customerPersonID,24497) = p.personID (+)
And am.miniTeamID = qpp.miniTeamID
And qpp.personID = SonarSession.sPersonID
And exists ( Select 1 From ERPerson er
Where er.personID = SonarSession.spersonID
And er.miniTeamID = r.miniTeamID
And er.securityLevelCode in (5, 7, 8)
And r.requestID Not IN (Select requestID From QueueRequest_TMP)
UNION
-- Third Set
Select DECODE(r.PriorityCode,2,1,2) priority,
NVL(p.CUSTOMERPRIORITYCODE,3) CUSTOMERPRIORITYCODE,
qpp.managerID managerID,
qpp.priority queuePriority,
r.lastModDate lastModDate,
r.requestID requestID,
r.miniTeamID miniTeamID
From SRequest r, Person P, QueuePersonPref qpp, Auto_MiniTeam am
Where r.requestTypeCode = 1
And r.statusCode In (2, 3)
And r.miniTeamID In (
Select childMiniTeamID
From MiniTeamTree
Where childMiniTeamID = r.miniTeamID
And parentMiniTeamID = qpp.MiniteamID
And levelFromParent = 1
And r.lastModDate < (l_sysDate - 14)
And NVL(r.customerPersonID,24497) = p.personID (+)
And am.miniTeamID = qpp.miniTeamID
And qpp.personID = SonarSession.sPersonID
And exists ( Select 1 From ERPerson er
Where er.personID = SonarSession.spersonID
And er.miniTeamID = r.miniTeamID
And er.securityLevelCode in (5, 7, 8)
And r.requestID Not IN (Select requestID From QueueRequest_TMP)
Order By 2, 3, managerID desc, queuePriority, lastModDate
It is imperative you read the Oracle Performance and tuning giude first and foremost!!
http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/toc.htm
After that you may want to investigate the following built in package
dbms_sqltune.create_tuning_taskThis is a small sample, but do not attempt to understand the output if you haven't read the guide!
declare
l_task_id varchar2(20);
l_sql varchar2(5000);
begin
l_sql :='select decode(r.PriorityCode,2,1,2) priority,
nvl(p.CUSTOMERPRIORITYCODE,3) CUSTOMERPRIORITYCODE,
qpp.managerID managerID,
qpp.priority queuePriority,
r.lastModDate lastModDate,
r.requestID requestID,
r.miniTeamID miniTeamID
from SRequest r, Person P, QueuePersonPref qpp, Auto_MiniTeam am
where r.requestTypeCode = 1
and r.statusCode = 1
and r.assigned_PersonID is not null
and r.miniTeamID in (select childMiniTeamID
from MiniTeamTree
where childMiniTeamID = r.miniTeamID
and parentMiniTeamID = qpp.MiniteamID
and levelfromParent = 1
and r.lastModDate < (l_sysDate - 8/24)
and NVL(r.customerPersonID,24497) = p.personID
and am.miniTeamID = qpp.miniTeamID
and qpp.personID = SonarSession.sPersonID
and exists ( select 1 from ERPerson er
where er.personID = SonarSession.spersonID
and er.miniTeamID = r.miniTeamID
and er.securityLevelCode in (5, 7, 8)
and r.requestID not in (select requestID from QueueRequest_TMP)';
l_task_id := dbms_sqltune.create_tuning_task(sql_text => l_sql
,user_name => 'APPS'
,scope => 'COMPREHENSIVE'
,time_limit => 120
,task_name => 'SQL1');
dbms_sqltune.execute_tuning_task ('SQL1');
end;
-- After running the above, find out what the best SQL is using the following:
set long 30000
set longchunksize 30000
set linesize 2000
select dbms_sqltune.report_tuning_task('SQL1') from dual;
Similar Messages
-
Hi,
How to tune SQL Queries ? Performance wise what precautions to take for writing the SQL queries ?
Regards,
KiranKiran Bathula wrote:
How to tune SQL Queries ?
Learn how the optimizer works.
Learn what it it capable of.
And then.
Just start. The only way to become a SQL tuner, is to just do it (and do it many many times). -
hello all
i have a query. i want to abort a query running in a thread with a help of another thread
my programs looks like this
public class test
public static void main(String args[]) throws Exception
String driverName = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@192.168.103.46:1521:test";
Class.forName(driverName); // load the driver
Connection connection = DriverManager.getConnection(url, "scott", "tiger");
ConnThread connThread = new ConnThread();
connThread.stmt = connection.prepareCall("{call NEWOBJECT(?)}");
connThread.stmt.registerOutParameter(1,OracleTypes.CURSOR);
connThread.start();
System.out.println ("waiting");
Thread.sleep(20);
System.out.println ("waiting done");
System.out.println ("closing conn");
connThread.stmt.cancel();
System.out.println ("closing conn done");
class ConnThread extends Thread
CallableStatement stmt = null;
public void run()
try
System.out.println ("Executing query");
stmt.executeQuery();
System.out.println ("Executing query done");
catch(Exception e)
e.printStackTrace();
My prob is that i have achieved that in case of normal sql query. but i have to do the same for SQL procedures. can ne one tll me is it even possible to do so. Also i want to check this for range of databases mainly for oracle, MS SQL and MS Access.
Thanking in advance
Regards
SaurabhKiran Bathula wrote:
How to tune SQL Queries ?
Learn how the optimizer works.
Learn what it it capable of.
And then.
Just start. The only way to become a SQL tuner, is to just do it (and do it many many times). -
Need help for SQL Queries Tunning
hi all,
we have a procedure for search consumers, which using sql queries like:
SELECT TRIM (NAME) AS NAME, TRIM (accno) AS accno,
TRIM (connaddress) AS connaddress,
TRIM (CATEGORY) AS CATEGORY, TRIM (landmark) AS landmark,
SUBSTR (accno, 1, 3) AS subdivisionname
FROM consumermaster
WHERE LOWER (accno) LIKE
LOWER ('%' || NVL (caccno, '#noval#') || '%')
OR LOWER (NAME) LIKE LOWER ('%' || NVL (cname, '#noval#') || '%')
OR LOWER (connaddress) LIKE
LOWER ('%' || NVL (cadd, '#noval#') || '%')
OR phone LIKE '%' || NVL (cphone, '#noval#') || '%'
OR accno = (SELECT accno
FROM requestregistration
WHERE requestid = creqid)
UNION
SELECT TRIM (NAME) AS NAME, TRIM (accno) AS accno,
TRIM (connaddress) AS connaddress, TRIM (CATEGORY)
AS CATEGORY,
TRIM (landmark) AS landmark,
SUBSTR (accno, 1, 3) AS subdivisionname
FROM scodetails
WHERE LOWER (accno) LIKE
LOWER ('%' || NVL (caccno, '#noval#') || '%')
OR LOWER (NAME) LIKE LOWER ('%' || NVL (cname, '#noval#') || '%')
OR LOWER (connaddress) LIKE
LOWER ('%' || NVL (cadd, '#noval#') || '%')
OR phone LIKE '%' || NVL (cphone, '#noval#') || '%'
OR accno = (SELECT accno
FROM requestregistration
WHERE requestid = creqid);
it's ok for small tables but now data increase .......
searching method is very slow
now i want to tune this query for better performance
please sugg me best method
Thanks in advance
Regards
vij..The link given by Asif should get you on the right track for tuning this query.
I just formatted your SQL:
SELECT Trim(NAME) AS NAME,
Trim(accno) AS accno,
Trim(connaddress) AS connaddress,
Trim(category) AS category,
Trim(landmark) AS landmark,
Substr(accno,1,3) AS subdivisionname
FROM consumermaster
WHERE Lower(accno) LIKE Lower('%'
||Nvl(caccno,'#noval#')
||'%')
OR Lower(NAME) LIKE Lower('%'
||Nvl(cname,'#noval#')
||'%')
OR Lower(connaddress) LIKE Lower('%'
||Nvl(cadd,'#noval#')
||'%')
OR phone LIKE '%'
||Nvl(cphone,'#noval#')
||'%'
OR accno = (SELECT accno
FROM requestregistration
WHERE requestid = creqid)
UNION
SELECT Trim(NAME) AS NAME,
Trim(accno) AS accno,
Trim(connaddress) AS connaddress,
Trim(category) AS category,
Trim(landmark) AS landmark,
Substr(accno,1,3) AS subdivisionname
FROM scodetails
WHERE Lower(accno) LIKE Lower('%'
||Nvl(caccno,'#noval#')
||'%')
OR Lower(NAME) LIKE Lower('%'
||Nvl(cname,'#noval#')
||'%')
OR Lower(connaddress) LIKE Lower('%'
||Nvl(cadd,'#noval#')
||'%')
OR phone LIKE '%'
||Nvl(cphone,'#noval#')
||'%'
OR accno = (SELECT accno
FROM requestregistration
WHERE requestid = creqid); You are using some function on almost each and every column in the where clause. Try getting rid of them as they are hindering the use of indexes, if any, on any of the columns.
Also the guidelines in the link provided are the best starting point. -
Help for rewrite or tune this quer
Hi,
can u some help to rewrite or tune this quer.
SELECT 20100201 PERIOD_KEY,CONSUMER_KEY,DOW_KEY PREFDOW,nvl(FIN_SCOR_DOW,-1),'MONTH' GRANULAR FROM
SELECT CONSUMER_KEY,DOW_KEY,FIN_SCOR_DOW,
ROW_NUMBER() OVER ( PARTITION BY CONSUMER_KEY ORDER BY FIN_SCOR_DOW DESC,DOW_KEY ) RNO
FROM
SELECT CONSUMER_KEY,DOW_KEY,SUM(SCORE_SERVICE_WEIGHT) FIN_SCOR_DOW FROM
SELECT DOW_KEY,CONSUMER_KEY,SERVICE_KEY,DUR,TRAN,VOLU,TOT_DUR,CUM_DUR,TOT_TRAN,CUM_TRAN,TOT_VOL,CUM_VOL,SCORE_DUR,SCORE_TRAN,SCORE_VOL,
1*NVL(SCORE_DUR,0)+1*NVL(SCORE_TRAN,0)+1*NVL(SCORE_VOL,0) TOT_SCOR ,
CASE
WHEN SERVICE_KEY= 0 THEN
1*SCORE_DUR
WHEN SERVICE_KEY IN ('1','3') THEN
1*SCORE_TRAN
WHEN SERVICE_KEY = 2 THEN
1*SCORE_VOL
END SCORE_SERVICE_WEIGHT FROM
select DOW_KEY,consumer_key,service_key,sumDUR dur,SUMTRAN tran,sumVOL volu,
tot_dur,cum_dur,tot_tran,cum_tran,tot_vol,cum_vol,
case
when tot_dur > 0 then
cum_dur*100/tot_dur
end score_dur,
case
when tot_tran > 0 then
cum_tran*100/tot_tran
end score_tran,
case
when tot_vol > 0 then
cum_vol*100/tot_vol
end score_vol
from
SELECT CONSUMER_KEY,SERVICE_KEY,DOW_KEY,SUMDUR,SUMTRAN,SUMVOL,SUM(SUMDUR) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ) TOT_DUR,
SUM(SUMDUR) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ORDER BY SUMDUR,DOW_KEY) CUM_DUR,
--SUM(SUMDUR) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ORDER BY SUMDUR,DOW_KEY,RNO) CUM_DUR,
SUM(SUMTRAN) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ) TOT_TRAN,
SUM(SUMTRAN) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ORDER BY SUMTRAN,DOW_KEY) CUM_TRAN,
--SUM(SUMDUR) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ORDER BY SUMDUR,DOW_KEY,RNO) CUM_DUR,
SUM(SUMVOL) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ) TOT_VOL,
SUM(SUMVOL) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ORDER BY SUMVOL,DOW_KEY) CUM_VOL
--SUM(SUMDUR) OVER (PARTITION BY CONSUMER_KEY,SERVICE_KEY ORDER BY SUMDUR,DOW_KEY,RNO) CUM_DUR,
FROM
SELECT CONSUMER_KEY,SERVICE_KEY, to_number(to_char(to_date(DATE_KEY,'YYYYMMDD'),'D')) DOW_KEY,
sum(SUM_OF_DURATION) sumdur,SUM(NO_OF_TRANSACTIONS) sumtran,sum(SUM_OF_VOLUME) sumvol
--ROW_NUMBER () OVER (ORDER BY CONSUMER_KEY) RNO
FROM SERVICE_FACTS_BY_DAY
WHERE DATE_KEY BETWEEN 20100201 AND 20100228
group by CONSUMER_KEY,SERVICE_KEY,to_number(to_char(to_date(DATE_KEY,'YYYYMMDD'),'D'))
ORDER BY CONSUMER_KEY,SERVICE_KEY,to_number(to_char(to_date(DATE_KEY,'YYYYMMDD'),'D'))
GROUP BY CONSUMER_KEY,DOW_KEY
WHERE RNO=1;explain plan
Plan hash value: 3130556327
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Pstart| Pstop |
| 0 | SELECT STATEMENT | | 571K| 28M| | 128K (1)| 00:29:54 | | |
|* 1 | VIEW | | 571K| 28M| | 128K (1)| 00:29:54 | | |
|* 2 | WINDOW SORT PUSHED RANK | | 571K| 59M| 217M| 128K (1)| 00:29:54 | | |
| 3 | HASH GROUP BY | | 571K| 59M| 217M| 128K (1)| 00:29:54 | | |
| 4 | VIEW | | 1713K| 179M| | 93314 (1)| 00:21:47 | | |
| 5 | WINDOW SORT | | 1713K| 127M| 157M| 93314 (1)| 00:21:47 | | |
| 6 | WINDOW SORT | | 1713K| 127M| 157M| 93314 (1)| 00:21:47 | | |
| 7 | WINDOW SORT | | 1713K| 127M| 157M| 93314 (1)| 00:21:47 | | |
| 8 | VIEW | | 1713K| 127M| | 34903 (2)| 00:08:09 | | |
| 9 | SORT GROUP BY | | 1713K| 40M| 340M| 34903 (2)| 00:08:09 | | |
| 10 | PARTITION RANGE ITERATOR| | 8090K| 192M| | 13172 (2)| 00:03:05 | 1 | 25 |
|* 11 | TABLE ACCESS FULL | SERVICE_FACTS_BY_DAY | 8090K| 192M| | 13172 (2)| 00:03:05 | 1 | 25 |
Predicate Information (identified by operation id):
1 - filter("RNO"=1)
2 - filter(ROW_NUMBER() OVER ( PARTITION BY "CONSUMER_KEY" ORDER BY SUM(CASE "SERVICE_KEY" WHEN 0 THEN 1*CASE WHEN
("TOT_DUR">0) THEN ("CUM_DUR"*100/"TOT_DUR") END WHEN 1 THEN 1*CASE WHEN ("TOT_TRAN">0) THEN
("CUM_TRAN"*100/"TOT_TRAN") END WHEN 3 THEN 1*CASE WHEN ("TOT_TRAN">0) THEN ("CUM_TRAN"*100/"TOT_TRAN") END WHEN 2
THEN 1*CASE WHEN ("TOT_VOL">0) THEN ("CUM_VOL"*100/"TOT_VOL") END END ) DESC ,"DOW_KEY")<=1)
11 - filter("DATE_KEY"<=20100228 AND "DATE_KEY">=20100201)You are posting your request to the Enterprise Manager Grid Control forum.
So I assume that you are using OEM Grig Control.
You could then start using the SQL Tuning Advisor to provide you with an alternative query, execution plan etc.
If you are not using OEM Grid Control, I suggest that you post your request to a Database forum.
Regards
Rob -
Trace/tune SQL Developer startup?
I am trying to tune the startup time of SQL Developer.
The best hint I found so far is disabling all extensions not needed. (in my case all the migration assistants, and the check for 'looking for updates automatically' reduced the startup time from approx. 60 sec down to 30 sec).
Still I'd like to know if (and how) I can squeeze more time out of it. To do so, I'd like to know where I spend most of the time.
Can someone hint me how I can trace the startup procedure, so I can find the most time consuming actions during startup?953600 wrote:
I am new to SQL Developer, having recently downloaded it. Could anyone please let me know what the Username and Password is for any/all the test database is ? Also what databases and tables are available for practicing SQL queries. I am new to Oracle OCA training and am completely lost with the heaps of documentation which never mentions how to access test databases. I would really apreciate any help I can get as I am doing self study and have no mentors, teachers etc. My email is [email protected] and would appreciate anyone replying with this information and any other tips. Thanks in advance.
The passwords are whatever they were set to when the database was created.
SQL Developer is just a client tool. It doesn't come with a database. It expects that you already have a database which it can connect to.
And putting your email address in a posting on a forum is A Very Bad Idea (tm). No on on the forum is going to respond to it, but a million address harvesters will sell it to spam sources. Expect to be flooded with email offers for the following
1) products to enhance the size of certain body parts
2) Nigerians who desperately need to move large sums of money and are willing to pay a total strangers for assistance.
Edited by: EdStevens on Aug 19, 2012 4:44 PM -
Erratic Report Region Behavior with Dynamic SQL Queries
I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
or sometimes
failed to parse SQL query:ORA-01403: no data found
The only solution I've found so far is to:
1) Make a copy of the failed report region.
2) Disable or delete the original failed report region.
The new copy of the report region runs without issue.
My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
ORA-06502:PL/SQL: numeric or value error: character string buffer too small
Re: Import Export Error (ORA-06502)
The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.Hi all,
My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
Cheers,
Joel -
Error while running the sql queries in unix as cron job..
Hi,
I've configured some sql queries to run as cronjob from unix,i'm able to excute all the sql queries with out any error,after all the queries are executed,I'm getting the following error message.
ORA-00600: internal error code, arguments: [4080], [1], [131], [], [], [], [],
Could any one advise me why this error is being thrown?
How to avoid this error?
Thanks,
AnilAre you running these queries through TopLink?
If so, the error seems to be occurring on the database, when the query is being executed.
I have never seen that error before. Performing some websearches it seems to be a general database error, potentially something to do with synchronization. Sorry I can't be of more help, perhaps the database forum can provide more insight... -
Need help in SQL Queries using GUI controls or variables
Hello, all
I have a big problem (I have already had with Visual Basic a few mounths ago) with Java while writing my SQL Queries.
I would like to know how I must do to use variable data or GUI control data in my SQL Query to select only some records.
Here, my first Query that works without any problem (no WHERE clause !!!) :
Statement requeteBedes = connectBedes.createStatement();
ResultSet resultatSeries = requeteBedes.executeQuery("SELECT * FROM Series");
initComboBoxSeries(resultatSeries);the method "initComboBoxSeries" fills a JComboBox with all the names of the series in my database.
Here comes my problem.I would like to use the value of the selected "series" in the JComboBox to search in another table of the same Database. I made another statement but it returns a Null ResultSet :
ResultSet resultatSearchAlbumsFromSeries = requeteBedes.executeQuery("SELECT * FROM bandes_dess WHERE ser_nom = '" + strComboBoxSeriesSelected + "' "); The variable strComboBoxSeriesSelected contains the value of the selected line in the combobox with all the series, filled after the first query that is here above and that works very well.
Could some one help me and tell me how I must use variables or GUI controls values in my SQL Queries or tell me if there is a place where I could find an explanation of that kind of problems (like more "advanced SQL Queries", as the ones currently used in all the Learning Java 2 books)
Thank you all for your help.
Christian.executeQuery() will never return null. At least that's what the spec says. You are probably catching an exception (probably a syntax error caused by a single quote in strComboBoxSeriesSelected) and ignoring it. Or do you mean the ResultSet contains no rows?
Anyway, to use parameterized queries, take a look at PreparedStatements. Your code should look like this using PreparedStatement:Statement requeteBedes = connectBedes.prepareStatement("SELECT * FROM bandes_dess WHERE ser_nom = ?");
requeteBedes.setString(1, strComboBoxSeriesSelected);
ResultSet resultatSeries = requeteBedes.executeQuery();Alin. -
How to get the SQL queries based on SQL_ID.
Hi Experts,
I want to get the SQL queries based on SQL_ID.
I have tried the following query,but I am not getting full query.
[code]SET linesize 132 pagesize 999
column sql_fulltext format a60 word_wrap
break on sql_text skip 1
SELECT REPLACE (TRANSLATE (sql_text, '0123456789', '999999999'), '9', ''),sql_id
FROM dba_hist_sqltext s
WHERE s.sql_id = '7tvurftg8zryb';[/code]
One of my friend said use grid to get full query text.
Can you please help me how to use grid ,else any other method to get the full query based on SQL_ID.
Please help me.
Thanks in advance.You have these many options to set, if sql_text is really huge. But better use a tool(TOAD) as it's really helpful and easy to use instead! (See my previous comment).
column sql_text format A10000
set echo off
set head off
set feed off
set verify off
set termout off
set lines 10000
set long 1000000
set trimspool on
set pages 0
Thanks! -
Developing portlets for dummies (sql queries)
Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)
So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.
edit: ok, stupid user error; I suck at using Toad, so I was looking at the wrong schema altogether :D So now i see the public views and packages, so forget that bit of the question.
But still, I cannot see even wwsbr_all_folders -view, much less the wwpob_page$ -table. I cannot see any way to find the pages that are in my page group. Somehow it must be doable, right?
Have I done something wrong, missed a step in enabling my test-provider / schema perhaps? I don't really know what I'm doing, but I followed instructions here: http://home.c2i.net/toreingolf/oracle/portal/my_first_plsql_portlet.htm (excellent instructions, thanks!)
So should my portlet be able to access those tables or not? How the heck has the third partly portlet maker done it?
i'm on OracleAS Portal 10g Release 2 (10.1.4)
Edited by: Baguette on 23-Apr-2009 05:13
Edited by: Baguette on 23-Apr-2009 05:32i see your perspective now. and let me give a perspective to my first reply too.
what i proposed to you was the answer of what i quoted in the message. that is, why didn't you see those views in the new schema you created! and it is still ok but it is done in the portal schema for which you should have privielges too and i assumed you had. my mistake!
now, i can relate your privacy concerns with your earlier message:
Hello, I've been trying to build a dynamic menu. First I went with just plain old plsql: i created a function in the portal schema that returns an unordered, nested list of the pages in my pagegroup and called that function in a regular pl/sql item on my portal page. I did this by querying the wwpob_page$ table and that went just great in my test&development setup (of which I am the admin of course :))
+Then I realized that since I'm not an administrator of the server hosting our portal and I only have very limited privileges (I am only a page group administrator) I will probably not be allowed to utilize this function nor will they agree to install it in the portal schema, and I decided I should build a portlet that does the same thing (so it can be registered and so on, and so it can use the synonyms and tools that are available to registered providers). There already is such a portlet (and provider) registered for use in the target portal, but I don't like it because i uses tables and hard-coded styles so I will cook my own, better version. :)+
+So I downloaded an example portlet and am getting the hang of it, but now I just can't for the life of me figure out how to enable any sql-queries. I have run the provsyns-.sql script, logged in as test_provider/portal and installed my portlet-package as test_provider user. I can see the available pl/sql packages in Toad, but there are no tables or views for me to to see. That means I can't query the portal tables that I need to.+
- by downloading an example portlet, you probably mean you created a new schema. because provsyns work on a schema.
- if you are not the administrator of the portal, and may not be able to access some portions of the portal, it means that you do not use the portal user (the user which serves as the owner of the portal schema).
- now, your plan to create a new schema and give those privielges would still not work. because, by creating a new schema you cannot sneak in to the oriignal portal schema if you do not have privileges to do it. obvious, right? otherwise, it would be a vulnerability of the software that you can see what you are not allowed to see by creating a new schema.
- however, there is a bright side here. the views give records based on your privileges.
- so if your administrators have generated them already or if they generate on the original portal schema, then you may see the pages and items that you have privileges to see and no more.
so now, you may ask the administrators if they have already done it, and if not, then if they would be willing to do it.
hope that helps!
AMN -
Hello everybody,
First off, let me apologize if my inquiry does not belong on this forum. I am confident however, that someone here has had experience with this since Oracle and ruby on rails/ruby are used frequently. My fingers are crossed, here's is my problem:
I am currently working on a database system that utilizes ruby on rails
with a oracle database. Here's the situation:
the ruby on rails web application is up and running;
my oracle database is full of tables that are populated with data;
there is a successful connection between rails and my oracle database;
however, what isn't finished is I currently have data mining queries in
sql (eg. find minimum time someone has been employed = "Select
min(time) from table...etc") and what I need to do is write one ruby
program for each of my sql queries so that the ruby program:
1) connects to the oracle database each time the query is called
2) runs the sql query on the oracle database
3) takes the results from the query and returns them in an array or
something of that nature (so that I can use the results in an html file
on the ruby on rails web application).
Again, I apologize if this question does not belong on this forum. If someone however has experience with this could you please give me example code of what this would look like (using different sql queries). Thank youI apologize if this question does not belong on this forum. OTN does have a forum dedicated to Ruby/Ruby On Rails. I admit it doesn't seem to get much traffic. I think that's because most people working with Ruby tend to go for F/OSS products.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/ -
Hello,
I have quite strange question related to my research.
Probabley within Oracle DB there is some dynamic library which is parsing SQL queries,
for example.
SELECT * FROM schema.table which is able to extract informations from SQL listed above that we want to display all columns from selected table.
When this construction is valid ( SQL standard ) the next step is verification the object existence in DB. It means
that there are two separated actions which are analyzing queries.
I need only first part of that process, which will give me informations about all object used in SQL query
is it possible to accomodate that internal parser witin stand alone middleware like Weblogic Event Server ?
I can do it with regular expression patters, but it's not going to be fast and effective for subqueries and all advanced
constructions for DHW like MODEL, etc.
Thank You,
R.>
http://search.cpan.org/~rehsack/SQL-Statement-1.23/lib/SQL/Statement.pm
BUGS AND LIMITATIONS ^
* currently we treat NULL and '' as the same - eventually fix
* No nested C-style comments allowed as SQL99 says
>
That's the reason why I want to use dedicated for 11g EE library ;-)
Thanks for quick reply -
? in SQL Queries and not using prepared statements
Using EclipseLink 1.1.1
Prepared Statements are disabled
In our production server something went wrong and one of our Read Queries started erroring. A DatabaseException was thrown and we log the "getQuery.getSQLString()" statement. We found this query in the logs:
SELECT t1.ID, t1.NAME, t1.DESCRIPTION, t1.EXTREFID, t1.STYLESHEET, t1.DDSVNVERSION, t1.FIRSTNAME, t1.LASTNAME, t1.EMAILADDR, t1.PHONENUMBER, t1.ADDRESS, t1.ADDRESS2, t1.CITY, t1.STATE, t1.POSTALCODE, t1.COUNTRY, t1.ADMINACCTNAME, t1.HASDOCUMENTS, t1.HASTIMEDNOTIFICATIONS, t1.STATUS, t1.ENTRYDATE, t1.EVALEXPDATE, t1.LASTREMINDDATE, t1.FULLUSERS, t1.LIMUSERS, t1.REQUSERS, t1.ISENTERPRISE, t1.EXPDATE, t1.ISDISABLED, t1.DISABLEDDATE, t1.NEEDLICENSEAGREEMENT, t1.ISWARNINGDISABLED, t1.LOCALE, t1.TIMEZONE, t1.CURRENCY, t1.DOMAIN, t1.DOCUMENTSIZE, t1.EXTRADOCUMENTSTORAGE, t1.ONDEMANDOPTIONS, t1.SSOTYPE, t1.RESELLERID, t1.ACCOUNTREPID, t1.LASTUSAGEREPORTDATE, t1.NEXTUSAGEREPORTDATE, t1.USAGEREPORTATTEMPTS FROM T_SSOOPTIONS t0, T_CUSTOMERS t1 WHERE *((((t0.SSOENABLED = ?) AND (t1.SSOTYPE IN (?, ?))) AND (UPPER(t1.DOMAIN) = ?)) AND (t0.CUSTOMERID = t1.ID))*
Notice the values weren't entered into the where clause. We had to bounce the application to fix the problem. I've never seen this before. I've added more debugging statements to the code - so if this happens again in the future I'll have more information to report on. In the mean time I'm wondering if anyone else has every seen a problem of this nature.Database error due to invalid SQL statement.
I don't have a stack, we were catching the exception and not printing the stack :(
Like I mentioned in my first post, I added more debugging code (e.printStackTrace()). I understand this is hard to track down without more information. I was just hoping you guys had seen something like this before and had any insight. Like I mentioned before: this is on our production server. I've never seen this type of error before. That particular server (we run in a cluster mode) had been up for several days and then started generating that error. IT bounced the node and everything went back to normal. We have been using toplink for about 5 years now and have never seen this problem, until August 3rd 2009. The only thing that has changed recently is our migration from toplink 10 to EclipseLink. I was wondering if anyone knows if anything had changed in EclipseLink/toplink 11 with the generation of SQL queries.
I'll keep looking. There is more debugging code in there now. Since the error was "Database error due to invalid SQL statement" this implies the SQL was generated, exited that part of the code and was sent to the db where it failed. I'm afraid the printStackTrace won't help if this error happens again. -
Does anyone know how to create a JSP which allows the user to input data into a simple database and then allow the user to input SQL queries? I can do this in a servlet but must hard code the query. It would be great to be able to type in differnet queries to see the results.
Thanks
Michaelhai,
I am giving u a small example which allows user to enter data in the html page and the same is submitted by the Jsp page in the database.
<%@ page language="java" import="java.sql.*" %>
<html>
<body bgcolor="#FFd08d" >
<%! Connection conn;
Statement st,st1;
ResultSet rs,rs1;
int i,j;
%>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection("jdbc:odbc:--DSNName--","--DataBaseUserName--","--DataBasePassword--");
catch(Exception e)
%>
Error in Saving : <%=e%>
<%
try
String email_address=request.getParameter("email_address");
String query_text=request.getParameter("query_text");
PreparedStatement st=null;
String inst="insert into databasename..DataBaseTableName(email_address,query_text) values (?,?)";
st=conn.prepareStatement(inst);
st.setString(1,email_address);
st.setString(2,query_text);
st.executeUpdate();
conn.close();
%>
Your query is Submitted.<br>
Thanks.
<%
catch(SQLException e)
%>
Error in Saving : <%=e%>
<%
%>
</body>
</html>
I think this will solve ur query.
bye
sameer
Maybe you are looking for
-
Start script automatically after place Word text in indesign document
I need start a script, automatically, after plece Word text in indesign document... It's possible ???
-
I am unable to see the mail content in my iPad since few days.
Hello , for few days I cann't see the mail content. There is only blank page that comes. Sender name comes in inbox only. Please help.
-
Hi ALL, Good Day! Need your help in clarifying the following doubts related to Embedded BW: Presently am working for a solution proposal for a client: Client is using Embedded BW on CRM and reporting is based on that. They also have plans to have Emb
-
Is it poss to edit 2 tracks - mic&pickup, simultaneously in sample editor?
(I'm a total novice in Logic so it's easy to blind me with jargon) I've recorded a guitar with mic and pickup and want to be able to see and edit both tracks at the same time in Sample Editor. Any idea how? The manual says: "If you're dealing with an
-
I asked before why I could not send pictures thru my verizon email or my work (outlook email thru my phone) but only by wifi. If I took it off wifi the pictures go through, no problem. SO I go through gmail no problems but never got an answer why it