Can someone see why im getting error in this query ?
I had 2 queries , instead of using left join i put them together. Now i get error , can someone just take a look to see if syntax wrong somewhere ?
select * from
select i.ips,
a.ips,
a.question_type,
sum(a.score) score,
p.project_name,
p.project_segment,p.location,p.project_exec_model,
p.project_exec_model||' - '||p.project_config pmodel,
one.score schedule,two.score cost,three.score execution,four.score commercial,
nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0) as total,
(select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips) prev_score,
(select max(createdt) from tbl_risk_answer where (ips,sample_num) in
(select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips) last_dt
from
(select v.project_id,v.ips,v.sample_num,v.question_id,v.header_desc,v.section_area,v.score,
decode(bi_recurse(q.active_question,1,2),2,'OTR','-')||decode(bi_recurse(q.active_question,1,1),1,'ITO','-') question_type
from VW_RISK_SCORE v left join tbl_risk_question q on v.question_id=q.question_id
where (v.project_id,v.sample_num) in
(select project_id,max(sample_num) sample_num from VW_RISK_SCORE group by project_id)
) a,
(select distinct ips from VW_RISK_SCORE) i,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=1 group by ips) one,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=2 group by ips) two,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=3 group by ips) three,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=4 group by ips) four,
tbl_risk_project p
where i.ips=one.ips(+) and i.ips=two.ips(+) and i.ips=three.ips(+) and i.ips=four.ips(+) and ito on scores.ips=ito.ips
and i.ips=p.ips and a.question_type='-ITO' group by i.ips,a.ips, a.question_type, p.project_name, p.project_segment, p.location, p.project_exec_model, p.project_exec_model||' - '||p.project_config, one.score, two.score, three.score, four.score, nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0), (select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips), (select max(createdt) from tbl_risk_answer where (ips,sample_num) in
(select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips)
) scores and here is error I get.
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 12
ORA-00920: invalid relational operator
00604. 00000 - "error occurred at recursive SQL level %s"
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
Error at Line: 30 Column: 4
You would move them to the from-clause, just like one, two, three and four.
Something like:
untested for obvious reasons
select *
from (select i.ips,
a.ips,
a.question_type,
sum(a.score) score,
p.project_name,
p.project_segment,
p.location,
p.project_exec_model,
p.project_exec_model || ' - ' || p.project_config pmodel,
one.score schedule,
two.score cost,
three.score execution,
four.score commercial,
nvl(one.score, 0) + nvl(two.score, 0) + nvl(three.score, 0) +
nvl(four.score, 0) as total,
(select sum(prev_score) prev
from xt_risk_past2
where ips = i.ips) prev_score,
(select max(createdt)
from tbl_risk_answer
where (ips, sample_num) in
(select ips, max(sample_num)
from vw_risk_score
group by ips)
and ips = i.ips) last_dt
from (select v.project_id,
v.ips,
v.sample_num,
v.question_id,
v.header_desc,
v.section_area,
v.score,
decode(bi_recurse(q.active_question, 1, 2),
2,
'OTR',
'-') ||
decode(bi_recurse(q.active_question, 1, 1),
1,
'ITO',
'-') question_type
from vw_risk_score v
left join tbl_risk_question q
on v.question_id = q.question_id
where (v.project_id, v.sample_num) in
(select project_id, max(sample_num) sample_num
from vw_risk_score
group by project_id)) a,
(select distinct ips from vw_risk_score) i,
(select ips, sum(score) score
from vw_risk_score
where section_area = 1
group by ips) one,
(select ips, sum(score) score
from vw_risk_score
where section_area = 2
group by ips) two,
(select ips, sum(score) score
from vw_risk_score
where section_area = 3
group by ips) three,
(select ips, sum(score) score
from vw_risk_score
where section_area = 4
group by ips) four,
tbl_risk_project p
-- moved part I
(select ips,
sum(prev_score) prev
from xt_risk_past2
where ips = i.ips) five --or whatever
-- moved part II
(select ips,
max(createdt) maxcreatedt
from tbl_risk_answer
where (ips, sample_num) in (select ips, max(sample_num)
from vw_risk_score
group by ips)
group by ips) six -- or whatever
where i.ips = one.ips(+)
and i.ips = two.ips(+)
and i.ips = three.ips(+)
and i.ips = four.ips(+)
and i.ips = five.ips -- outerjoin if needed
and i.ips = five.ips -- outerjoin if needed
and ito on scores.ips = ito.ips
and i.ips = p.ips
and a.question_type = '-ITO'
group by i.ips,
a.ips,
a.question_type,
p.project_name,
p.project_segment,
p.location,
p.project_exec_model,
p.project_exec_model || ' - ' || p.project_config,
one.score,
two.score,
three.score,
four.score,
nvl(one.score, 0) + nvl(two.score, 0) +
nvl(three.score, 0) + nvl(four.score, 0),
five.prev,
six.maxcreatedt
) scoresI wonder how all this is going to perform by the way....all those scalar subqueries and outer joins are expensive....
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1594885400346999596
Read up on Subquery Factoring/WITH-clause, and try to rewrite parts of your query.
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4423923392083
Similar Messages
-
Can someone quickly spot the syntax error in this basic XML query?
I'm very new to SQL/XML and I'm using this query in the basic HR schema provided by Oracle in the 10g Express Edition Database.
I'm getting the "ORA-00907: missing right parenthesis" message when I run the following query, but the parenthesis all seem to match up:
SELECT
XMLELEMENT ("EMPLOYEES",
XMLAGG(XMLELEMENT ("DEPARTMENTS",
XMLELEMENT ("Department", department_name),
(SELECT
XMLELEMENT ("EMPLOYEE",
XMLAGG(XMLELEMENT ("Empno", employee_id),
XMLELEMENT ("Job", job_id),
XMLELEMENT ("FirstName", first_name),
XMLELEMENT ("LastName", last_name),
XMLELEMENT ("Email", email),
XMLELEMENT ("Phone", phone_number)))
AS result
FROM employees
WHERE employees.department_id = departments.department_id)))
AS result
FROM departments)You do have the correct number of parenthesis, just the last one is in the wrong spot. Here is the corrected version. I moved the trailing ) to before "AS result"
SELECT
XMLELEMENT ("EMPLOYEES",
XMLAGG(
XMLELEMENT ("DEPARTMENTS",
XMLELEMENT ("Department", department_name),
(SELECT
XMLELEMENT ("EMPLOYEE",
XMLAGG(
XMLELEMENT ("Empno", employee_id),
XMLELEMENT ("Job", job_id),
XMLELEMENT ("FirstName", first_name),
XMLELEMENT ("LastName", last_name),
XMLELEMENT ("Email", email),
XMLELEMENT ("Phone", phone_number)
) AS result
FROM employees
WHERE employees.department_id = departments.department_id
AS result
FROM departmentsI don't have those tables installed but when I made a few tweaks and tried to run the above it encountered an error in regards to the inner XMLAGG. I tweaked your exampled and ended up with this. Feel free to change if not what you intended to produce.
SELECT
XMLELEMENT ("EMPLOYEES",
XMLAGG(
XMLELEMENT ("DEPARTMENTS",
XMLELEMENT ("Department", department_name),
(SELECT
XMLAGG (
XMLELEMENT("EMPLOYEE",
XMLFOREST (employee_id AS "Empno",
job_id AS "Job",
first_name AS "FirstName",
last_name AS "LastName",
email AS "Email",
phone_number AS "Phone"
FROM employees
WHERE employees.department_id = departments.department_id
AS result
FROM departments -
I tried to download Tetris yesterday onto my laptop - not quite what you would call an ambitious gamer!
As it was doing so I noticed that the software was trying to alter some settings in the registry.
Now whenever I am in Mozilla I get a pop up saying my PC has 7 window errors and can run faster. I cannot see how to get rid of this.
When I copy the link location it says:
https://secure-ams.adnxs.com/click?KGIRww5jtj8oYhHDDmO2PwAAAICXbtI_KGIRww5jtj8oYhHDDmO2Py8cBrFeTaRkUe4MK_5ewBbHVyJRAAAAAMypEAA_AQAAPwEAAAIAAAAwB0YA6-ECAAAAAQBVU0QAVVNEACwB-gDulQAA42kAAQMCAQUAAIQARiCzrAAAAAA./cnd=%21ngVsMQjTqzoQsI6YAhjrwwsgBA../referrer=https%3A%2F%2Fwww.google.co.uk%2F/clickenc=http%3A%2F%2Fappround.net%2Fpcperformer%2Fst6%2Fpcperformer-st6.php%3Fcid%3D3902%26tid%3Dams1CNHcs9ji35fgFhACGK-4mIjrq5PSZCIOMjEzLjc4LjE0NC4yMTQoAQ..
and here is the image
Any ideas?Such a pop-up is likely caused by malware installed on your computer.
Do a malware check with some malware scanning programs on the Windows computer.<br />
You need to scan with all programs because each program detects different malware.
Make sure that you update each program to get the latest version of their databases before doing a scan.
*Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
*SuperAntispyware:<br>http://www.superantispyware.com/
*Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
*Windows Defender: Home Page:<br>http://www.microsoft.com/windows/products/winfamily/defender/default.mspx
*Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
*Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
You can also do a check for a rootkit infection with TDSSKiller.
*http://support.kaspersky.com/viruses/solutions?qid=208280684
See also:
*"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked -
When attempting to start iTunes, I get the following: "The iTunes library file cannot be saved. An unknown error occurred (-50)." Can someone please help me get this fixed?
Same problem here since latest update. As usual poor support from Apple with no answer or fix for this bug.
-
Why do I have a constant notification on my settings? How do I get rid of it? Looked through everything and can't see why it's there
Restore from a backup will get you some 'other' back.
Still not happy, Restore in iTunes, Setup as new. Sync back personal data using iTunes Tabs -
My iPhone 4s gets really warm. Can someone explain why? It gets warm when I'm browsing.
computer CPUs use very small wires that heat up when electricity is passed through them. Its actually one of the major limiting factors in miniaturization, making the wires too small and they melt.
-
Can someone see what is wrong with this? Im stumped
public class Card {
int suit;
int value;
static int isStraight = 0;
static int isFlush = 0;
static int handCounter = 0;
static int cardCounter = 0;
boolean inUse = false;
public int getSuit() {
return suit;
public void setSuit(int suit) {
this.suit = suit;
public int getValue() {
return value;
public void setValue(int value) {
this.value = value;
public boolean isInUse() {
return inUse;
public void setInUse(boolean inUse) {
this.inUse = inUse;
public static int checkPairs(int[] handValues){
for (int x = 0; x<5; x++ ){
for (int y = 0; y<5; y++ ){
if(handValues[x]==handValues[y]){
cardCounter ++;
handCounter = handCounter + (cardCounter - 1);
cardCounter = 0;
System.out.println(handCounter);
return handCounter;
public static int checkStraight(int[] handValues){
if(handValues[0] == (handValues[1]-1)){
if (handValues[1] == (handValues[2]-1)){
if (handValues[2] == (handValues[3]-1)){
if (handValues[3] == (handValues[4]-1)){
///System.out.println("straight");
isStraight = 1;
if (handValues[4] == 12){
isStraight = 2;
return isStraight;
public static int checkFlush(Card[]inputHand){
if (inputHand[0].suit == inputHand[1].suit){
if (inputHand[1].suit == inputHand[2].suit){
if (inputHand[2].suit == inputHand[3].suit){
if (inputHand[3].suit == inputHand[4].suit){
isFlush = 1;
return isFlush;
//handCheckerApp ,
import tcdIO.*;
public class handCheckerApp {
///these string arrays just hold the names of the values
static String[] suitsArray = {"hearts" , "spades" , "diamonds" , "clubs" };
static String[] valuesArray = {"two" , "three" , "four" , "five" , "six" , "seven" , "eight" , "nine" , "ten" , "jack" , "queen" , "king" ,"ace" };
public static void main (String arguments []) {
Terminal terminal = new Terminal();
Card[] inputHand = new Card[5];
Card[] deck = new Card[52];
Card currentCard = new Card();
for(int number = 0 ; number <= 12 ; number++){
deck[number]= new Card();
deck[number].suit = 0;
deck[number].value = number;
for(int number = 13 ; number <= 25 ; number++){
deck[number]= new Card();
deck[number].suit = 1;
deck[number].value = (number - 13);
for(int number = 26 ; number <= 38 ; number++){
deck[number]= new Card();
deck[number].suit = 2;
deck[number].value = (number - 26);
for(int number = 39 ; number <= 51 ; number++){
deck[number]= new Card();
deck[number].suit = 3;
deck[number].value = (number - 39);
terminal.println("Poker Hand Checker");
terminal.println("~~~~~~~~~~~~~~~~~~");
terminal.println("Suits key:..Hearts = 1");
terminal.println("...................Spades = 2");
terminal.println("...................Diamonds = 3");
terminal.println("...................Clubs = 4");
terminal.println(".............................");
terminal.println("Values key:.Twos = 2");
terminal.println("......................Threes = 3");
terminal.println("......................Fours = 4");
terminal.println("......................Fives = 5");
terminal.println("......................Sixes = 6");
terminal.println("......................Sevens = 7");
terminal.println("......................Eights = 8");
terminal.println("......................Nines = 9");
terminal.println("......................Tens = 10");
terminal.println("......................Jacks = 11");
terminal.println("......................Queens = 12");
terminal.println("......................Kings = 13");
terminal.println("......................Aces = 14");
///this block of code marks cards in the deck as in use and adds them to the hand
for(int i = 0; i < 5; i++){///for1
currentCard.value = (terminal.readInt("please enter card " + (i+1) + " value: " )-2);
currentCard.suit = (terminal.readInt("please enter card " + (i+1) + " suit: " )-1);
for (int x = 0; x< 52; x++){///for2
if (deck[x].value == currentCard.value){///if1
if (deck[x].suit == currentCard.suit){///if2
if (deck[x].inUse == true){///elseif1
terminal.println("you chose that card already");
i--;
}///if3
else if(deck[x].inUse == false){///if3
deck[x].inUse = true;
inputHand[i] = deck[x];
terminal.println("this card is the " + valuesArray[(inputHand.value)] + " of " + suitsArray[(inputHand[i].suit )]);
}///elseif1
}///if2
}///if1
}///for2
}///for1
int handValues[] = {inputHand[0].value, inputHand[1].value, inputHand[2].value, inputHand[3].value, inputHand[4].value};
java.util.Arrays.sort(handValues);
///this method checks for pairs, two pairs, three of a kind, full house & four of a kind
Card.checkPairs(handValues);
if (Card.handCounter == 2) {
terminal.println("You have a pair");
if (Card.handCounter == 4) {
terminal.println("You have two pair");
if (Card.handCounter == 6) {
terminal.println("You three of a kind");
if (Card.handCounter == 8) {
terminal.println("You have a full house");
if (Card.handCounter == 12) {
terminal.println("You have four of a kind");
} else {
terminal.println("");
Card.checkStraight(handValues);
Card.checkFlush(inputHand);
if (Card.isStraight == 1 && Card.isFlush == 0){
terminal.println("You have a straight");
if (Card.isStraight == 1 && Card.isFlush == 1){
terminal.println("You have a straight flush");
if (Card.isStraight == 2 && Card.isFlush == 0){
terminal.println("You have a royal straight");
if (Card.isStraight == 2 && Card.isFlush == 1){
terminal.println("You have a royal straight flush");
if (Card.isStraight == 0 && Card.isFlush == 1){
terminal.println("You have a flush");
if (Card.isStraight == 0 && Card.isFlush == 0){
terminal.println("");
Okay it's not recognising deck.inUse....i can't see why.
Can someone possibly point out some suggestions. Thanks, much appreciated.> if (deck[x].inUse == true){///elseif1
>
it's giving me an error on this If else statement...
sorry ....
How about going the extra mile and actually posting the error message you receive rather than expecting everyone to guess? The more pertinent information you can provide, the easier it is to answer your question. And you want your question answered easily and quickly, right?
~ -
I have an iphone 4 and cannot get my mute off when I am using Facetime. I can hear them, but they can't hear me. When I touch the mute button, nothing happens. Can someone please tell me how to fix this?
the mute button is a switch you need to flip, not touch. if you look at it and see color, its on.
-
Can someone please help me get some?
I was a summer intern student worker and the company brought us Macbooks. I never really knew about Macbooks at the time and kinds still dont and now my macbook is starting to act up I see I lost my repair plan cause its been a min or whatever. So can someone please help me get sometype of repair something?
Please make a Genius Appointment and take it in for service.
-
can someone help me to get the link where to download adobe acrobat pro XI english/arabic version?
for english:
if you follow all 7 steps you can dl a trial here: http://prodesigntools.com/adobe-acrobat-xi-pro-standard-reader-direct-download-links.html
and activate with your serial.
if you have a problem dl'g, you didn't follow all 7 steps. the most common error involves failing to meticulously follow steps 1,2 and/or 3 (which adds a cookie to your system enabling you to download the correct version from adobe.com). -
Can someone explain why the Secure Easy Setup light on a...
Can someone explain why the Secure Easy Setup light on a WRT54G would change from a steady green to steady orange after firmware upgrade? Everything is connecting properly, and I see no change in performance of network other than light change described. Thanks.
The way I understand the Secure Easy Setup button is this.
It will be orange when the router is in normal operation mode. The light turns green when you press the Cisco Systems button (that is orange normally) so that the router will search for the web device you are trying to connect to the router. If you want to disable this feature all together go into your router settings page at 192.168.1.1
Go to the Wireless tab, and then the Advanced Wireless Settings sub-heading, once in there look for the option SecureEasysetup and simply set it to disable (enabled is default) then click the save now and apply the settings. The light should be out now meaning you don't have the Secure Setup feature enabled.
It is just a personal choice to have it on or off, it should not affect router or internet performance unless you hit the button trying to connect a device to the network.
Message Edited by MontanaXVI on 12-14-2007 07:12 PM -
I can't open PSE. Get error message 150:30 and restarting computer doesn't help. Any suggestions?
Please try out the instructions mentioned in this article.
Thanks!! -
Hi all, can someone help me in getting last login date of a user in CQ5 please?
Hi all, can someone help me in getting last login date of a user in CQ5 please?
CQ is REST based and does not have the concept of session. So there is no feature to track login or logout details. Most of our customers use some kind of central authentication Ex- SSO hence no need arises to have such functionality built in. However if needed you have the ability to implement such at a project level solution. Ex:- custom login modules or auth-handler by taking project specific constraints and requirements into account
-
After update, Itunes can't load. I get error message R6034, attempt to load the C runtime library incorrectly.
I also get error code 7 (Windows error 1114), saying itunes wasn't installed correctly. It appears that I am not the only one with this issue. what is wrong with the latest update?? I tried removing Itunes and all of its components and installing it again, but get same errors and i have also tried doing a system restore with the same resultsDoublechecking. Have you also tried the following user tip?
Troubleshooting issues with iTunes for Windows updates -
After update, Itunes can't load. I get error message R6034, attempt to load the C runtime library incorrectly.
I also get error code 7 (Windows error 1114), saying itunes wasn't installed correctly.
Tried removing Itunes and installing again, but get same errorsTry the following user tip:
Troubleshooting issues with iTunes for Windows updates
Maybe you are looking for
-
Remote Control and Firewall WinXP SP2
Does any of you guys know how to prepare WindowsXP SP2 release which would enable firewall settings when installed? What is the most efficient way to handle this? I am just trying to prepare the remote control issue before SP2 is released. Thanks in
-
RichText with HTML markup in PDF
Hello I've come to the point, when I need to display rich text with html markups in output PDF. PDF is going to be printed and I don't want anything to be editable. I've started with xsd schema for the xdp template, where particular element looks lik
-
Carrier sign still showing after wiping and reloading OS?
Hello dear users, In my thread of "application installation issues", it seems to be determined that my carrier who I got the phone from, is blocking the install of applications as I get a 910 error, application authorization failure, when i try to in
-
TS3694 Error 1015? What is it
Trying to restore my iPhone through itunes, and an error message appeared just as I was expecting everything to be complete. Anyone have any ideas how I can restore my iPhone?
-
What is the movement type?
Hi, can the movement type 531be used for posting of GR from by-product of an Production order from the production storage area? is it the right one for the particular action??Plz reply. Thanks in advance