Clause of update with a nested select statement, and a weird error
Hi all!I am trying to execute the following SQL clause:
setting a day of f_kontakti kon set ikaluokka =
(
Select ikal of
(
Select kontakt_ik, ikaluokka_gen(1,ai2.pvm,ai.pvm) as ikal
of f_kontakti k
Join the a on (k.asiakas_ik = a.asiakas_ik) d_asiakas
Join d_aika HERE on (a.synt_aika_ik = ai .aika_ik)
Join d_aika ai2 on (k.aika_ik = ai2.aika_ik)
where k.kontakt_ik = kon.kontakt_ik
) salt
)
It works very well on our test database (10.2.0.1.0), but when I try to run it on our production database (10.2.0.4.0), it gives the following error:
ORA-00904: "KON". "" KONTAKT_IK ": invalid identifier
The nested select works fine when I run it separately (without where clause of course, because then it does not really anywhere point) on two databases, but for some reason, the full update only fails on the production system. Any ideas on what could cause this?
Kind regards
Erik
You can run it without selecting it nesting.
Like this
update f_kontakti kon
set ikaluokka=
(
select ikaluokka_gen(1,ai2.pvm,ai.pvm) as ikal
from f_kontakti k
join d_asiakas a on (k.asiakas_ik=a.asiakas_ik)
join d_aika ai on (a.synt_aika_ik=ai.aika_ik)
join d_aika ai2 on (k.aika_ik=ai2.aika_ik)
where k.kontakt_ik=kon.kontakt_ik
);
or even shorter
update f_kontakti kon
set ikaluokka=
(
select ikaluokka_gen(1,ai2.pvm,ai.pvm) as ikal
from d_asiakas a on (kon.asiakas_ik=a.asiakas_ik)
join d_aika ai on (a.synt_aika_ik=ai.aika_ik)
join d_aika ai2 on (kon.aika_ik=ai2.aika_ik)
);
Tags: Database
Similar Questions
-
I am trying to create a query that returns the last date of order for the customer... the invoiced sales table contains a "calendar_id' I need to select the MAX, and then return the"activity_date"of the calendar table.
Here's what I have so far...
----------
SELECT
SALES. NATIVE_REPORTING_CUSTOMER_ID,
CUST. CLIENT_NAME,
CUST. SAP_CUSTOMER_NUMBER,
SALES_AREA. SALES_ORGANIZATION,
(select
DW. Calendar.activity_date
Of
DW. CALENDAR
where
DW. Calendar.calendar_id = Max (SALES. ORDER_CALENDAR_ID))
as MAX_ORDER_DATE
Of
DW. Sale INVOICED_SALES_FACT,
DW. CUST OF THE CUSTOMER,
DW. SALES_AREA
WHERE
SALES. NATIVE_REPORTING_CUSTOMER_ID = CUST. NATIVE_CUSTOMER_ID
AND SALES. SALES_AREA_ID = SALES_AREA. SALES_AREA_ID
AND CUST. CURRENT_FLAG = 'Y '.
AND SALES_AREA. SALES_ORGANIZATION IN ('ATS1', "ESS1")
GROUP BY
SALES. NATIVE_REPORTING_CUSTOMER_ID,
CUST. CLIENT_NAME,
CUST. SAP_CUSTOMER_NUMBER,
SALES_AREA. SALES_ORGANIZATION
----------
But I get the error
"Group feature is not allowed here."
which is of course related to the nested select statement I have the return date of the calendar table.
Pointers?
THXOf course, this should be better:
SELECT xyz.NATIVE_REPORTING_CUSTOMER_ID, xyz.CUSTOMER_NAME, xyz.SAP_CUSTOMER_NUMBER, xyz.SALES_ORGANIZATION, (select dw.calendar.activity_date FROM DW.CALENDAR where dw.calendar.calendar_id=xyz.MAX_SALES_ORDER_CALENDAR_ID) as MAX_ORDER_DATE FROM ( -- added this SELECT SALES.NATIVE_REPORTING_CUSTOMER_ID, CUST.CUSTOMER_NAME, CUST.SAP_CUSTOMER_NUMBER, SALES_AREA.SALES_ORGANIZATION, max(SALES.ORDER_CALENDAR_ID) as MAX_SALES_ORDER_CALENDAR_ID -- changed this FROM DW.INVOICED_SALES_FACT sales, DW.CUSTOMER CUST, DW.SALES_AREA WHERE SALES.NATIVE_REPORTING_CUSTOMER_ID=CUST.NATIVE_CUSTOMER_ID AND SALES.SALES_AREA_ID=SALES_AREA.SALES_AREA_ID AND CUST.CURRENT_FLAG='Y' AND SALES_AREA.SALES_ORGANIZATION IN ('ATS1','ESS1') GROUP BY SALES.NATIVE_REPORTING_CUSTOMER_ID, CUST.CUSTOMER_NAME, CUST.SAP_CUSTOMER_NUMBER, SALES_AREA.SALES_ORGANIZATION ) XYZ -- added this
Published by: Toon Koppelaars June 18, 2009 14:23
-
Hello
Is it possible to write a select statement that is nested in the form of oracle?
the query I'm putting runs a TOAD all its giving me an error when I compile it in the form...
My request is something like:Encountered the symbol "SELECT" when expecting one of the following....
Thank you very much.SELECT COL1 -- SELECT #1 INTO V_COL FROM TB1, TB2, TB3 WHERE -- CONDITION 1 AND -- CONDITION 2 AND NVL(( SELECT #2 UNION SELECT #3 ),VAL)) BETWEEN VAL1 AND VAL2
HST,
Try the code below.
SELECT NVL(PCF.CTR_INFORMATION1, 'NO_CONTACT') INTO V_TYPE FROM PER_PEOPLE_F PAPF, PER_ALL_ASSIGNMENTS_F PAAF, PER_CONTRACTS_F PCF, ( SELECT TRUNC(SYSDATE) CHK_DATE FROM PER_PERSON_TYPE_USAGES_V PPTU WHERE PPTU.PERSON_TYPE_ID = PAPF.PERSON_TYPE_ID AND PPTU.PERSON_ID = PAPF.PERSON_ID AND PPTU.USER_PERSON_TYPE = 'Employee' UNION SELECT MAX(PASF_TER.EFFECTIVE_END_DATE) CHK_DATE FROM PER_PERSON_TYPE_USAGES_V PPTU, PER_ALL_ASSIGNMENTS_F PASF_TER WHERE PPTU.PERSON_TYPE_ID = PAPF.PERSON_TYPE_ID AND PASF_TER.PERSON_ID = PPTU.PERSON_ID AND PPTU.PERSON_ID = PAPF.PERSON_ID AND PPTU.USER_PERSON_TYPE = 'Ex-employee' HAVING MAX(PASF_TER.EFFECTIVE_END_DATE) IS NOT NULL ) CON WHERE TRUNC(SYSDATE) BETWEEN PAPF.EFFECTIVE_START_DATE AND PAPF.EFFECTIVE_END_DATE AND PAPF.PERSON_ID = PAAF.PERSON_ID AND NVL(CON.CHK_DATE, SYSDATE) BETWEEN PAAF.EFFECTIVE_START_DATE AND PAAF.EFFECTIVE_END_DATE AND PAPF.PERSON_ID = :BLOCK.PER_ID AND PAAF.PRIMARY_FLAG = 'Y' AND PAAF.PERSON_ID = PCF.PERSON_ID (+) AND PAAF.CONTRACT_ID = PCF.CONTRACT_ID (+)
Kind regards
Manu.
-
calling a package with in a select statement
Hi all..
I created two packages and pack8 called tabpack8 package... two different ways...
There is an error with this statement
Select the name MyName rab8 where place = tabpack8.test2 (myplace, 10);
so... How can I call a package with in a select...
CREATE or REPLACE PACKAGE tabpack8 authid current_user as
procedure test1 (place out varchar2, myid number);
function return number (place in varchar2, myid number) test2;
end;
/
create or replace package body tabpack8 as
procedure test1 (place out varchar2, myid number) is
Start
SELECT place of rab8 where id = myid;
end Test1;
function test2 (place in varchar2, myid number) return number is
number of l_num;
Start
Select place in l_num rab8 where id = myid;
Return l_num;
end test2;
END tabpack8;
/
CREATE or REPLACE PACKAGE pack8 authid current_user as
operative;
end;
create or replace package body like pack8
operation is
MyPlace varchar2 (20);
MyName varchar2 (20);
Start
tabpack8.test1(MyPlace,10);
Select the name MyName rab8 where place = myplace;
dbms_output.put_line ('Res-' | myname);
Select the name MyName rab8 where place = tabpack8.test2 (myplace, 10);
dbms_output.put_line ('Res-' | myname);
end test;
END pack8;
/
Thanks in advance
gud dayTry this and let us know.
function test2(place in varchar2,myid in number ) return varchar2 is l_var tab8.place%type; begin select place into l_var from tab8 where id = myid; return l_var; end test2;
Thank you
Knani. -
Vector map of the USA and Canada with the boundaries of State and province
Hello
I'm looking for a map free vector of the USA and the Canada that includes the States and border provinces on this subject so I can fill in each State with different colors. I searched and searched, but didn't succeed. Anyone here have any ideas? Thank you.
Mark
It looks decent.
http://Commons.wikimedia.org/wiki/file:BlankMap - USA-States-Canada-provinces, _HI_closer.svg
I don't think you looked very hard.
-
original title: freezing after login! ... disk hard dwm.exe and dllhost.exe errors. As usual load screen and then nothing can be used/open to all. Occasionally start opens and closes and nothing else beyond.
Cannot use the laptop mode safe mode with networking. Have you tried to repair registry free of bugs and using Vista install with view to repair OS repair disk, but there are a lot of people having this problem different from this problem with dwm.exe dwm.exe or versions/varieties. This is is produced immediately after the download and installation of Microsoft Updates I might add. Please can someone help? Thank you very much... LiZ :)
Never use Registry Repair programs.
They can cause more harm than good.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.bleepingcomputer.com/tutorials/tutorial140.html
Understand the Extras in Windows Vista and Windows Update info is at the link above.
Remove the Vista updates; two ways to do this:
1. a System Restore to before the updates:
Click Start > programs > Accessories > system tools > System Restore > restore time/choose your own date > next
If you use Norton, disable it before using the system restore.
If it is impossible to enter the Normal Mode, do a Safe Mode system restore:
Press F8 at the startup/power and the list of startup options, use THE ARROW key to select Safe mode > and then press ENTER.
System restore steps according to the info above.
Also:
2. click on start > right click on computer > properties > Windows updates down the lower left corner > updates installed in the lower left corner in the next window
> then click the one that you don't want > uninstall will appear at the top > uninstall it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In addition, on the page where you clicked "Installed updates", click on change settings at the top left corner it
> Change update settings in the next page of AutoUpdate to "check for updates but let me choose etc" > OK ".
When you take a look at pending updates, you can either download/install them one at the time, namely the update causing you problems.
> or if you do not need an individual > right-click on > UAC prompt > hide it
See you soon.
Mick Murphy - Microsoft partner
-
Just joined upward with the CC from Adobe and get the error U44M1l210
Just joined up on top of the CC Adobe and lightroom installed and updated fine, but during the installation of Photoshop, it errors during the installation with U44M1l210.
Then I went back after running each application and tried to update, once again, still the same error if an error occurs. Looking around, I realized I should try and delete the app and reinstall.
After the abduction, reboot and reinstall I still had the same error. I then tried to use the update in the program, which, they say, there were updates, but even once, he ended up with the same error.
I do not have anywhere to download the update and install it manually, when it exists, maybe someone can give me a pointer.
Ask for details in the application of the CC, he says the following:
Update failed
Impossible to extract the downloaded files. Try to press to redownload again. (U44M1l210)
Needless to say, I tried each option as many times more and am at a loss where to go next...
Me again, if you are interested in the solution in this thread has work for me https://forums.adobe.com/thread/1086106
Good luck
-
Problem with the simple Select statements
Hi experts,
I have with SQL Server and I'm going to hurt when I use the similar syntax in sqlplus to query an Oracle table.
For example... my table contains column SCHID SET in the numeric form. Table has thousands of lines and the SCHID column is filled.
Select TOP 100 AFTSCHAUXDATA SCHID;
Get the "Word FROM key not found where expected" error
Select DISTINCT from AFTSCHAUXDATA SCHID;
Download "no selected lines.
Can someone help me please?
Thank you, JohnCan someone tell me how to find the names of the 20 largest tables (bigger which means that most of the files)?
Once you have updated statistics on the table, you can query the DataDictionary: USER_TABLES/ALL_TABLES/DBA_TABLES.
I'm assuming that user_tables will do:select * from ( select table_name , num_rows from user_tables order by num_rows desc nulls last ) where rownum <= 20;
You can find more explanations about the DataDictionary in the Oracle Online Documentation.
Just do a quick and easy search
http://www.Oracle.com/pls/db112/homepage
or
http://www.Oracle.com/pls/db102/homepage
Depending on your version of the database. -
function body pl/sql return SQL query - if with in the select statement
Hi all
I have a condition where, when the summary field is checked, only we see the this column for users in the report. IF statement is possible in this case? I gave the code below... is possible to write something like below, or y at - it another way to do it?
\
v_sql: = ' select TBLCASES. INVESTIGATOR as an INVESTIGATOR,';
v_sql: = v_sql | "TBLCASES. CASENUMBER as CASENUMBER,';
v_sql: = v_sql | "TBLCASES. OPENDATE as OPENDATE,';
v_sql: = v_sql | "TBLCASES. ESTCOMPLETE as DATE_CIBLE,';
v_sql: = v_sql | "TBLCASES. STATUS of STATUS ';
v_sql: = v_sql | "TBLCASES. Case CODE case CODE as,';
v_sql: = V_sql | "TBLCASES. FAIR_HOTLINE as FAIRHotline,';
v_sql: = v_sql | "TBLCASES. NYSIG as NYSIGCase,';
v_sql: = v_sql | "TBLCASES. The REGION';
IF: P44_INCLUDE_SUMMARY_FIELD is not null THEN
v_sql: = v_sql | "TBLCASES. SUMMARY,';
END IF;
v_sql: = v_sql | "TBLCASES. PROGAREA as PROGArea ';
v_sql: = v_sql | ' from TBLCASES where 1 = 1';
.. \Hi Lucie,.
You are adding and removing a column in a report, so it may be useful to have the extra on the end of the query.
You get an error? If so, paste it in...BUT - that I would put a condition on the column where ': P44_INCLUDE_SUMMARY_FIELD is not null '
It under 'Attributes of the column' report select the change column icon, and there a breadcrumb "Condition."
Select "In Expression 1 point value is not Null" and put the P44_INCLUDE_SUMMARY_FIELD in the Expression 1 text box.And I have to make it more readable like that when I do the dynamic SQL code:
IF: P44_INCLUDE_SUMMARY_FIELD is not null THEN
v_INCLUDE_SUMMARY_FIELD: = ' TBLCASES. SUMMARY summary ';
END IF;v_sql: = ' select TBLCASES. RESEARCHER, researcher,
TBLCASES. CASENUMBER as CASENUMBER
TBLCASES. OPENDATE as OPENDATE,
TBLCASES. ESTCOMPLETE as DATE_CIBLE,
TBLCASES. STATUS of STATUS,
TBLCASES. Case CODE case CODE as,
TBLCASES. FAIR_HOTLINE as FAIRHotline,
TBLCASES. NYSIG as NYSIGCase,
TBLCASES. REGION as the region,
TBLCASES. PROGAREA as PROGArea,' |
v_INCLUDE_SUMMARY_FIELD |
' from TBLCASES where 1 = 1; ';It will be useful,
BRITISH COLUMBIA -
Work with the nested case statement
Hi, I tried the SQL to the date below max but not a single runtime error
Select the case sensitive option
When f.rv = "BITTER" then
(case
When (m.SC. = 'A' and str_name = "ST_DT1")
or (m.SC. = 'B' and str_name = "ST_DT2")
or (m.SC. = 'C' and str_name = "ST_DT3") then
Max (m.STDT)
Where (mc.sc = 'C' and str_name = "ST_DT4")
or (mc.sc = 'K' and str_name = "ST_DT5") then
Max (MC. EDDT)
on the other
null
end)
on the other
null
end
of memo_con mc
baro_uy b
end f
ped pe
where b.id = mc.id
and pe.id = mc.mid
and pe.id1 = 1234
and b.cd = f.cd
and f.id = 93;
Could you please suggest me the correct way on it.
Thank you
You need a group of expression OR the only authorized linked should be aggregation function.
Onw solution could be to put the aggregate function (MAX) education all about box.
Like this
SELECT max)
case
When f.rv = "BITTER" then
case
When (m.SC. = 'A' and str_name = "ST_DT1")
or (m.SC. = 'B' and str_name = "ST_DT2")
or (m.SC. = 'C' and str_name = "ST_DT3")
then m.stdt
Where (mc.sc = 'C' and str_name = "ST_DT4")
or (mc.sc = 'K' and str_name = "ST_DT5")
then mc.eddt
end
end) as maxdate
of memo_con mc
baro_uy b
end f
ped pe
where b.id = mc.id
and pe.id = mc.mid
and pe.id1 = 1234
and b.cd = f.cd
and f.id = 93;
-
SELECT statement and decode.
Hi all.
I'm working with decode them but I get the wrong result. the following code shows the first not the U04 U02, U03 U01, I want to show all u01 until
U04 here is the code.
any suggestion?SELECT id, id2 , SUM(DECODE(id,55,AMOUNT,0)) TP, SUM(DECODE(ID,56,AMOUNT,0)) COMP FROM table where id2 in('u01','uO2','u03','u04') AND ID IN ('55','56') GROUP BY ID,ID2
SarahYou do not have all the lines where id2 in('u03','u04') and in id ('55 ', ' 56')
-
Hi all
Given the following code:
I can't succeed runnig this query:TYPE option_rec IS RECORD ( value varchar2(3), label varchar2(255) ); TYPE option_list_t IS TABLE OF option_rec; FUNCTION get_object_list RETURN option_list_t PIPELINED DETERMINISTIC IS tmp option_rec; BEGIN tmp.value:='1'; tmp.label:='foo'; PIPE ROW(tmp); tmp.value:='2'; tmp.label:='bar'; PIPE ROW(tmp); RETURN; END get_object_list; FUNCTION generate_select(selected_value in varchar2) RETURN sys_refcursor IS ret sys_refcursor; BEGIN open ret for select value as value, '(' || value || ') ' || label as label, case value when selected_value then 'selected' else '' end as selected from table(get_object_list); return ret; END generate_select;
I have the following error:select * from cursor(generate_select('2'))
What's wrong?ORA-00933: "SQL command not properly ended"
I run on Oracle 10 g 2With a function in defined pipeline looking for documentation for the SCOREBOARD operator
You must Select (TABLE (get_object_list ()) where... )
ConcerningEtbin
http://download.Oracle.com/docs/CD/B19306_01/AppDev.102/b14261/tuning.htm#sthref2351
Edited by: Etbin 27 April 2009 19:09
-
Problem with FF 19 on Windows and Mac - Facebook error?
I have a problem on Windows and my Mac with Firefox 19 - it has to do with Facebook. I have Facebook as a pinned tab and it will come to the forefront and tell me that the error running a script has been received. I can ignore or click "Cancel".
I don't know if the problem is with Firefox or Facebook - can someone enlighten me? And offer a possible "fix"?
Thank you
Many issues of the site can be caused by corrupted cookies or cache. To try to solve these problems, the first step is to clear cookies and cache.
Note: This will be you temporarily disconnect all sites, you're connected to.
To clear the cache and cookies to do the following:- Go to Firefox > history > clear recent history or (if no Firefox button is displayed) go to tools > clear recent history.
- Under "Time range to clear", select "all".
- Now, click the arrow next to details to toggle the active details list.
- In the list of details, see the Cache and Cookies and uncheck everything.
- Now click the clear now button.
More information can be found in article to clear your cache, history, and other personal information in Firefox .
This solve your problems? Please report to us!
-
XP Home addition running and by train to download a pack of compatibility for excellent 2002. It seems that I need the security update first.
Hello
I suggest you try the steps from the link below and check if it helps.
You receive an error '0 x 80070002' or '0 x 80070003' code after you download an update from Windows Update, Microsoft Update or Windows Server Update Services: http://support.microsoft.com/kb/910336
For your reference: You cannot install some programs or updates. http://support.Microsoft.com/kb/822798/
Hope this information is useful.
-
Problems with aligning an object/array and a popup error message of Muse
I will try to describe my two problems as simply as I can
Problem 1.
I create a mobile version of a Web site, I'm muse, after it is created, I went in the php file to change the details.
I've gotten to the point where everything works but I'm unable to align to the left of the table in the middle.
Now when I inspect element I see and point high (photo 1) the ' < table "tag with all that it contains, but when I go into the php file I can't see what
(photo 2). How can I change or add a tag that will align to the left of the table?
(www.avocabeachpicturetheatre.com.au/session-times-3.php)
Problem 2.
When you go to the page (both on mobile and desktop computer), I gives me an error message, I was able to change the text, but not get rid of it, as far as I can understand that it's something to do with the muse
(photo 3)
How can I get rid of this?
image 1 below
Image 2 below
Image 3 below
The problem, Ben, is that the page that contains the table is include file is generated dynamically. Unless Dale find the script that generates it, there is no way to change the value of the align attribute.
A possible solution is to add the following JavaScript just before the tag closing session-times - 3.php:
It is not an ideal solution, but it works.
Maybe you are looking for
-
where is my loading page indication bar to appear in the box address?
Just updated to FF 36.0.1. Now I have the red bar used to appear in the address box showing the progress of loading the page. I have to set an option somewhere or is this an extension/plugin?
-
Satellite L500 - 164 Unkown device in Device Manager
Hello.I recently installed Windows 7 on my L500-164 with all driver Vista 64. I have not found page to download special drivers for Windows 7 x 64 on the drivers.But there is always an instrument with an unknown status in Device Manager. I installed
-
Original title: Family Tree Maker does not connect on the Web dashboard. My Family Tree Maker 2009 does not connect to the Internet comes up with the message which is cannot authenticate the server, but it tells me that my version is up-to-date. He
-
Update of firmware for RV120w 1.0.5.6
Hello I have some problems with the latest firmware. I can't access on the WAN interface web, since I update to the latest firmware. I can return the Version 1.0.4.10 Thank you John
-
BlackBerry Smartphones 10-digit phone number
How to prevent a '1' are put in front of a 10 digit phone number during a call in the contacts list? All our local numbers are now 10 digits.