Surprised to see this in SQL
Hi all
Today, I encountered something strange in SQL, I kinda don't understand if it's acceptable.
create table xxc_emp (empno number, ename varchar2(30),sal number) ; create table xxc_dept(deptno number, dname varchar2(30)); insert into xxc_emp values(10,'Scott',2000); insert into xxc_emp values(20,'Clark',2500); insert into xxc_dept values(20,'Operations'); insert into xxc_dept values(30,'Human Resources'); commit;
Now this!
select * from xxc_emp where empno in (select empno from xxc_dept)
The statement above is not error despite the absent the xxc_dept empno column
Can someone share a light on this?
Thank you!
The statement above is not error despite the absent the xxc_dept empno column
Can someone share a light on this?
Yes - as is often the Oracle case "light" on this subject in literature.
https://docs.Oracle.com/CD/B28359_01/server.111/b28286/queries007.htm
Oracle performs a correlated subquery when a nested subquery that references a column in a fact table refers to a parent statement any number of levels above the subquery. The instruction of the mother can be a
SELECT
,UPDATE
, orDELETE
statement in which the subquery is nested. A correlated subquery is evaluated once for each row processed by the instruction of the mother. Oracle fixes columns in the subquery looking in tables named in the subquery then in tables named in the declaration of the parent.
See that LAST sentence?
You did NOT use a table alias. If that last sentence tells you EXACTLY how "Oracle resolves unqualified column.
Oracle fixes columns in the subquery looking in tables named in the subquery then in tables named in the declaration of the parent.
So you said, Oracle examines the "dept" subquery table and cannot find the column. If Oracle can consider the parent tables is the column in the table emp
The documentation is your friend. Spend time with your new friend.
Tags: Database
Similar Questions
-
How to see the generated sql code
Hello
With the help of obiee 10g, I would like to see the generated sql code.
I logged in as administrator
Following manage-> sessions-> view log
But when I click on connect gives this error ii do me "no logs found.
The RPD administrator is a user with the recording as a 2 level.
Thank youBI_ORACLE_HOME/server/log/nqquery.log
to learn more:
http://gerardnico.com/wiki/dat/OBIEE/nqquery.log
Another method
http://varanasisaichand.blogspot.com/2010/04/how-to-set-logging-level-for-users-in.html
Thank you
Deva
Published by: Devarasu on December 6, 2011 17:26
-
How to see all the sql on sql statements commands under 'history' link
Hi all
How to see the history of sql on sql commands tab.
I want to see all the sql statements.
Where we set if we need to store more sql statements in history.
We use Apex3.2 and 10g (EE) database.
Thank you
NrIs there a limitation to the Apex 3.2, there are only 200 files...
Not sure about this, as I said earlier, the report is configured to display a maximum of 1,000 records, perhaps during the in-house data entry in the apex, she could to check something. In any case, all these are an internal feature and is not supposed to be "messed" with and could lead to no support.
Your alternative uses the same method I proposed, and you can query manually (after granting dba) table of APEX_040000.wwv_flow_sw_sql_cmds or even do a report in your application with a csv export.
-
How to transform this PL/SQL query in a PL/SQL function?
Salvation of nice people!
I have a nice flash chart that SQL code is below. I want to see this table only if this query returns results. I tried to put it in condition. How transformt this ciode SQL "SLQ function returning a Boolean"?
Thank you for your kind replies.DECLARE X VARCHAR2 (4000); BEGIN x := 'SELECT NULL LINK, trunc(a.DATE1, '''||:P13_TRUNC||'''), avg(b.pourcentage_remplissage) FROM EVV_'||:P13_SITE||' a, bassin_remplissage b WHERE a.CLEF_VAR = (SELECT CLEF_VAR FROM SITE_ECHELLE WHERE SITE='''||:P13_SITE||''') AND round(a.valeur, 1) = b.cote_ngf AND DATE1 BETWEEN TO_DATE ('''||:P13_DATE_DEBUT||'000000'', ''DD/MM/YYYYHH24MISS'') AND TO_DATE ('''||:P13_DATE_FIN||'235959'', ''DD/MM/YYYYHH24MISS'') group by trunc(a.DATE1, '''||:P13_TRUNC||''') ORDER BY trunc(a.DATE1, '''||:P13_TRUNC||''')'; RETURN (X); END;
ChristianChristian:
Try this
DECLARE x VARCHAR2 (4000); BEGIN x := 'SELECT COUNT(*) FROM EVV_' || NVL(:p13_site, 'E003') || ' a, bassin_remplissage b WHERE a.CLEF_VAR = (SELECT CLEF_VAR FROM SITE_ECHELLE WHERE SITE=''' || NVL(:p13_site, 'E003') || ''') AND round(a.valeur, 1) = b.cote_ngf AND DATE1 BETWEEN TO_DATE (''' || NVL(:p13_date_debut, '01/01/1980') || '000000'', ''DD/MM/YYYYHH24MISS'') AND TO_DATE (''' || NVL(:p13_date_fin, '01/01/2080') || '235959'', ''DD/MM/YYYYHH24MISS'') '; EXECUTE IMMEDIATE x INTO WWV_FLOW.g_id; IF wwv_flow.g_id IS NULL OR wwv_flow.g_id = 0 THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END;
Published by: city has 8 July 2009 06:12
Moved the 'back' clause where it should be :)Published by: city has 8 July 2009 06:13
-
How can I write this in sql? (an another headcracker challenging the report)
Hi guys!
I need to create / generate a report. I intend to do all of this with only pure SQL.
Been cracking my head for days, but nothing helped.
Hope you gurus here me straightened out.
Here it goes. I have a table
TABLE USAGE_REPORT
------------------------------------
Date date of daily
BalanceCF NUMBER - the sum of initial departure or (balancebf)
Topup_amount NUMBER amount topup so far
Usage1 NUMBER - duration of the use of $ on certain prod
2 NUMBER - duration of the use of $ on certain prod
BalanceBF NUMBER - BalanceCF + refill - usage1-2 (which is also the next date of BalanceCF)
-----------------------------------------------
Example1
Please see this link
http://img9.imageshack.us/img9/708/88149028.gif
asumming that is my sql
WITH dates in the FORM
(
SELECT trunc (sysdate) + level dmy
DUAL CONNECT BY level < 366
),
Charging as
(
As the SELECT trunc (purchase_date), sum (payment_amount)
Purchase
Trunc GROUP (purchase_date)
),
Usage1 as
(
As the SELECT trunc (connect_date), sum (charged_amount)
OF tab1
WHERE prod_id = "xxx".
GROUP BY trunc (connect_date)
),
2 as
(
As the SELECT trunc (connect_date), sum (charged_amount)
Of THE tab2
WHERE prod_id = "yyy".
GROUP BY trunc (connect_date)
)
SELECT * DATE D
LEFT OUTER JOIN RELOAD T
WE (D.DMY = T.DATED)
LEFT OUTER JOIN USAGE1 U1
WE (D.DMY = U1. DATE OF THE)
LEFT OUTER JOIN U2 2
WE (D.DMY = U2. (DATED);
However
T1) how can I start to 'launch' the 1st row
BALANCECF so that i can do the math
of
BALANCECF + REFILL - USAGE1 - 2 = BALANCEBF
Q2) how can I put the value of BALANCEBF in the 2nd line of BALANCECF to make more calculation?
Q3) is that it has something to do and connect? parent-child relationship
Q4) brief how to make it look like the photo attach above?
Help, please!
Best regards
NoobI use 200 as initial balance_cf. did you not sample data, so code below is not tested:
WITH dates as ( SELECT TRUNC(SYSDATE) + level dmy, 200 balance_cf FROM DUAL CONNECT BY level < 366 ), topUP as ( SELECT trunc(purchase_date) dated, sum(payment_amount) topup_amount FROM purchase GROUP by trunc(purchase_date) ), Usage1 as ( SELECT trunc(connect_date) dated, sum(charged_amount) usage_amount FROM tab1 WHERE prod_id = 'xxx' GROUP BY trunc(connect_date) ), Usage2 as ( SELECT trunc(connect_date) dated, sum(charged_amount) usage2_amount FROM tab2 WHERE prod_id = 'yyy' GROUP BY trunc(connect_date) ) SELECT dmy, balance_cf + sum(topup_amount - usage1_amount - usage2_amount) over order by dmy rows between unbounded preceding and 1 preceding) balance_cf topup_amount, usage1_amount, usage2_amount, balance_cf + sum(topup_amount - usage1_amount - usage2_amount) over order by dmy) balance_bf FROM DATES D LEFT OUTER JOIN TOPUP T ON (D.DMY = T.DATED) LEFT OUTER JOIN USAGE1 U1 ON (D.DMY = U1.DATED) LEFT OUTER JOIN USAGE2 U2 ON (D.DMY = U2.DATED) ORDER BY dmy /
SY.
-
Hello, I have a page rekomendasiforex.com I try to open it via safari. Which gives a great result, but I do not see this widget in mobile display
Im very grateful for everyone has answered my question, thank you. And I'm sorry if I'm posting in the wrong section. Please move my post.
Kind regards
Works great on my iPad.
Try a simple Reset: hold down the Home and Power buttons until you see the Apple logo (10 to 20 seconds).
If you prefer, you can download their iOS app:
Investing.com - stock, Forex, Futures & News by Fusion Media Limited
-
When I send a text message and mobile data are off, it is not given, but I do not see this message for a few minutes. I can then refer using "send as a text message. How can I 'send as a text message' in the first place?
Disable the iMessage?
-
When I GET MOZILLA E-MAIL PAGE, ON THE UPPER LEFT corner, I HIT FILE, AND ONE OPTION FOR GETTING (IMPORT) MY OUTLOOK EXPRESS MAIL FROM pop.gmail WAS AVAILABLE. and see in mozilla MAIL; now, I do no more seem to see this BUTTON FILE?
Missing the bar of full Menu with file-Edit-View etc?
If Yes by pressing alt or F10 should appear. When he select display-toolbars and the Menu bar click on.
If you do not have the mail toolbar I which would turn on too. He has an e-mail button get on it. -
I have an iPad Air. I took a 40 min video with my iPad and am able to see it on the iPad. However, when I tried to transfer it to my laptop, I see this video on the laptop from the list of the iPad. It shows and transferred everything that I took on the iPad (other shorter videos and pictures) just not the big one one. How can I transfer it? Help, please.
This seems to be a "feature".
You must use an application like
"Dukto is a simple application that allows you to share files between devices connected to the same LAN (wireless) network."
http://www.tidal.it/?page_id=309&lang=en
http://www.msec.it/blog/?page_id=11
more info here:
How can I transfer large video files to iPad 2 for PC or a memory card without compression?
-
I want to assure you that my book mac pro has saved on my Time Capsule where I see this
I want to assure you that my book mac pro has saved on my Time Capsule where I see this
System Preferences > Time machine...
Date & time of the last backup is shown in the pane.
-
kb956196
Access Manager will not see this site, supervisor password needs. This page has been blocked by your approved sites list
We have forgotten the password. is there a way to reset the password or to disable it without the password?
Hello
Download and run the http://www.nirsoft.net/utils/conadvpass.html program (if you are able to access the site)
If not, perform this task:
"If you have forgotten the password of Access Manager, you can remove it by accessing this folder in Regedit (don't forget to back up your registry first):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\
CurrentVersion\Policies\Ratings
Select the key called icon in the right pane and press on delete. Close Regedit.
Now, you can start Internet Explorer and goto tools, Internet Options... Select the content tab and click on disable. When asked a password, do not write, just click OK. This will disable access Manager, since nothing is more a password. You can enable it again as soon as invent you a more memorable password"
-
"the site has encounter a problem and cannot display the page" Why am I seeing this whenever I try to access the center of update microsorf?
Hello
1 do you have service pack 3 installed on the computer?
2. what was the recent change in hardware or software performed on the computer before the question?
Please follow the links below to solve the problem.Method 1
You receive an error message "Windows Update has encountered an error and cannot display the requested page" when you try to install an update
http://support.Microsoft.com/kb/883614
Method 2Add the Windows Update Web sites to the trusted sites zone in Internet Explorer
If you have verified that your firewall and antivirus are not causing the problem, try adding the following Web sites for the Microsoft Internet Explorer Trusted sites zone on the computer where you use Windows Update. After you have added the following Web sites to the Microsoft Internet Explorer trusted sites zone, run Windows Update. To run this method, follow these steps:
a. start Internet Explorer.
b. on the Tools menu, click Internet Options.
c. click on the Security tab and then click on Trusted Sites.
d. click Sites.
e. Click to clear the requires a secure server (https :) for all sites in this zone check.)
f. in box add this website to the zone, type each of the following Web site addresses and then click Add:
o https://*.microsoft.com
o https://download.windowsupdate.com
o https://update.microsoft.com/windowsupdate
o http://*.update.microsoft.com
o https://*.update.microsoft.com
o http://download.windowsupdate.com
g. click closeand then click OK.
h. visit the Windows Update Web site or the Microsoft Update Web site.
I hope this helps.
-
Why can't I see this DVD that I just got?
I have Windows Media installed and that you have played with success of videos in the past. I just got a DVD of an offer of treadmill and when I tried to see it, I received a message that I didn't have a DVD "decoder? I am running Windows XP with SP3, as I was advised to have. Did anyone know why I can't see this video, but I discovered others all the time with success? Thank you!!!
You say look you 'video'... but have you ever watched DVD?
You may need a DVD decoder... See the following link:
Info about DVD decoders: Plug-ins for Windows Media Player
http://Windows.Microsoft.com/en-us/Windows/downloads/Windows-Media-Player/plug-insOr... It is possible that the following free software
Media Player will play your DVD:(FWIW... it's always a good idea to create a system)
Restore point before installing software or updates)VLC Media Player
http://www.videolan.org/ -
How can I see this as a an.iso, not a ready to burn iso image?
I use VM VirtualBox. I downloaded ReactOS as an .iso image. But then, I have Roxio and presented as a burning program. How can I see this as image an.iso?
You may need to uncheck 'Hide known file types' in Control Panel / folder Options / view to see the file extension. The .iso image file is normally not explored but is used by a third-party program such as Nero or Roxio to burn a CD.
There are some free programs that should allow you to explore the Image (.iso) file.
How to unzip an ISO file
http://www.ehow.com/how_6917568_uncompress-ISO-file.html -
original title: background logon of windows vista I do not see this background image instead, I see a solid blue color during startup and shutdown
I use a laptop with windows vista home basic 32-bit sp2
After turning on the computer laptop, I get a prompt to enter the password at this point, I would usually get a background image and the same background image appeared when I stopped
I do not see this background image instead, I see a blue solid color when you start and stop as the background image has been replaced by a blue color
I followed all the steps of the following
http://www.howtogeek.com/HOWTO/Windows-Vista/customize-your-Windows-Vista-logon-screen/
http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-desktop/can-you-customize-the-logon-screen/75def0ce-2dc4-48c1-B290-daaf685efca4
http://www.Vistax64.com/tutorials/79886-logon-screen-change.html
However, I don't see the background image. the background image is in the right folder location whith the required size as jpg image with the exact registry required such as mentioned in the above links entries
How do I solve this problem
Hello
Did you do changes on the computer before the show?
You can try the steps and check if you are able to see the background on the logon screen.
a. Click Start, and then type gpedit.msc
b. navigate to Computer Configuration and go to administrative templates and go to System.
c. go to connection and set the "bottom always use custom logon" to activate.
d. create a folder named C:\Windows\System32\oobe\info\backgrounds
e. put the file you want, and then name it backgroundDefault.jpg
f. check your other background for the dimensioning of the info files
Maybe you are looking for
-
PCI USB-3 D: CTO of HP Pavilion HPE h8-1150z
Which USB-3 PCI card (make and model) would be compatible with my computer? Is there anything that should be avoided? The card may only be installed or is there some other changes/upgrades necessary to make it work correctly?
-
ENVY 15 - 3040NR problem of brightness after upgrade to Windows 8
I have upgraded to windows 8 pro. Put updated and reinstalled all the drivers available on the website of HP drivers. The brightness is not set. I can see the cursor and move it, but it makes no difference. The keyboard shortcut keys are also display
-
extreme usb 3.0 differ in how to connect
A few years ago, I bought SanDisk Extreme USB 3.0 64 GB and it always occurs in the list of drives as a hard drive - see old_sd_64.jpg A few days ago I bought the same type, but in the list of drives, it's RemovableDisk, as (I think) should (new_sd_6
-
My computer (explorer.exe) continues the search for readers/records.
Hi experts, I need help on my PC.After working with my PC for several hours and minutes when I click/Open 'My Computer' it continues the search for my hard drives and folders in libraries, favorite & computer. He just continues to research and does n
-
for windows sound recorder 7; What is the perfet recorder
What is the perfet recorder