Access a variable level of subquery connection
With curr_date_details as
(
select to_date('16-dec-09', 'dd-mon-yy') as businessdate
, trunc( to_date('16-dec-09', 'dd-mon-yy'), 'iw') as bow
, to_date('23-nov-09', 'dd-mon-yy') as bop
, trunc(to_date('23-nov-09', 'dd-mon-yy'),'iy') as boy
, 3 as week_nbr
, 3 as per_week_nbr
, 12 as per_nbr
from dual
)
select --== Week Number
case when level <= date_rec.per_week_nbr
then level
when level = date_rec.per_week_nbr + 1
then 6
when level = date_rec.per_week_nbr + 2
then 7
when level = date_rec.per_week_nbr + 3
then 0
end as week_nbr
--== Start Date
, case when level <= date_rec.per_week_nbr
then to_date('23-nov-23', 'dd-mon-rr')
when level = date_rec.per_week_nbr + 1
then date_rec.bop
when level = date_rec.per_week_nbr + 2
then date_rec.boy
when level = date_rec.per_week_nbr + 3
then date_rec.boy
end as start_date
--== End Date
, case
when level <= date_rec.per_week_nbr
then to_date('23-nov-23', 'dd-mon-rr') + 6
when level = date_rec.per_week_nbr + 1
then date_rec.bow + 6
when level = date_rec.per_week_nbr + 2
then date_rec.bow + 6
when level = date_rec.per_week_nbr + 3
then date_rec.bop - 1
end as end_date
--=== Dummy Column
, case
when level <= date_rec.per_week_nbr
then ( select 1 + level as t from dual)
else 100
end as pesky_column
from dual mydual
inner join curr_date_details date_rec on date_rec.businessdate = to_date('16-dec-09', 'dd-mon-yy')
connect by level <= date_rec.per_week_nbr + 3
gives me the error:Error in the command line: 9 column: 2
Error report:
SQL error: ORA-01788: CONNECT BY clause in this query block
01788 00000 - 'CONNECT BY clause in this query block'
* Cause:
* Action:
How can I access subquery variable?
This question was taken from another post
Having trouble selecting from a table function
Hello
With the help of a joiin:
WITH connect_by_query AS
(
select --== Week Number
case when level <= date_rec.per_week_nbr
then level
when level = date_rec.per_week_nbr + 1
then 6
when level = date_rec.per_week_nbr + 2
then 7
when level = date_rec.per_week_nbr + 3
then 0
end as week_nbr
--=== Dummy Column
, LEVEL AS lvl
, per_week_nbr
from curr_date_details date_rec
connect by level <= date_rec.per_week_nbr + 3
)
SELECT cb.week_nbr
, case
when cb.lvl <= cb.per_week_nbr
then NVL (sd.sales, 0)
else 100
end as pesky_column
FROM connect_by_query cb
LEFT OUTER JOIN sample_data sd ON sd.datakey = cb.lvl
ORDER BY cb.lvl
;
You could also calculate week_nbr in the main query, rather than the subquery.
With the help of a scalar subquery:
WITH connect_by_query AS
(
select --== Week Number
case when level <= date_rec.per_week_nbr
then level
when level = date_rec.per_week_nbr + 1
then 6
when level = date_rec.per_week_nbr + 2
then 7
when level = date_rec.per_week_nbr + 3
then 0
end as week_nbr
--=== Dummy Column
, LEVEL AS lvl
, per_week_nbr
from curr_date_details date_rec
connect by level <= date_rec.per_week_nbr + 3
)
SELECT week_nbr
, case
when lvl <= per_week_nbr
then NVL ( ( select sales from sample_data where datakey = lvl)
, 0
)
else 100
end as pesky_column
FROM connect_by_query
ORDER BY lvl
;
Note that the connect_by_query of the subquery is the same in both cases.
Tags: Database
Similar Questions
-
How to allow access to all users of the connection on my computer?
How to allow access to all users of the connection on my computer?
Your question is hard to understand. I interpret as:
"How to allow all the users on my computer to access some files or folders?
The answer depends somewhat on the question of whether you have XP Pro or XP Home, but a general answer is found the following article.
"How to use file sharing Simple to share files in Windows XP"
<>http://support.Microsoft.com/kb/304040 >Click on "level 3: files in shared documents available to local users"
HTH,
JW -
to access the variables in a page in another page qml
Hey gang,
I've been watching some of the other problems autour to access the variables from one page on another page qml qml, and I can't get this to work.
I have a page, main.qml with a NavigationPane. The NavPane has a Page and some containers.
I have a property defined in the NavigationPane like this:
NavigationPane { id: mainNav backButtonsVisible: true property int customInt: 2 onCustomInt: { console.log(" -------------> App: customInt"); }
I have a ComponentDefinition for next page, called SettingsPage.qml. In the settings, I have two drop-down lists and a slider.
Page { actionBarAutoHideBehavior: ActionBarAutoHideBehavior.HideOnScroll id: pgSettings ScrollView { id: pageScroller scrollViewProperties.initialScalingMethod: ScalingMethod.AspectFit Container { topPadding: 25 bottomPadding: 25 rightPadding: 25 leftPadding: 25 Label { text: "Settings" textStyle.fontSize: FontSize.XLarge } Container { id: dropDown1 topPadding: 25 bottomPadding: 25 rightPadding: 25 leftPadding: 25 DropDown { id: ddOption1 title: "Option 1" verticalAlignment: VerticalAlignment.Center horizontalAlignment: HorizontalAlignment.Center Option {id: o1o1; text: "One"; } Option {id: o1o2; text: "Two"; } Option {id: o1o3; text: "Three"; selected: true; } Option {id: o1o4; text: "Four"; } onSelectedIndexChanged: { switch (selectedIndex){ case 0: // console.log(" -->App: Option 1 Selector, On"); customInt = 0; break; case 1: // console.log(" -->App: Option 1 Selector, Off"); customInt = 1;; break; case 2: // console.log(" -->App: Option 1 Selector, Top (default)"); customInt = 2; break; case 3: // console.log(" -->App: Option 1 Selector, Bottom"); customInt = 3; break; } } } } }
I look forward to the the statement will change the level property NavPane, called customInt, but it doesn't.
the output of the console shows that the ' App: Option 1 selector "gets selected in the dropdown list selected index changes, but the onCustomInt() funtion slot never gets called.
I tried "mainNav.customInt = X" too, but the parameters cannot solve the mainNav. I get "unknown symbol 'mainNav'" error with alittle bulb.
what I am doing wrong?
When you call the second page, SettingsPage.qml, set it as an object.
Don't do the following:
attachedObjects: [ ComponentDefinition { id: settingsPageDefinition source: "SettingsPage.qml" } ]
Follow these steps:
attachedObjects: [ // Definition of the second Page, used to dynamically create the Page above. ComponentDefinition { id: settingsPageDefinition Settingspage{ } } ]
Then the second page main navigation page in the IDE. I had the same problem with a multi-page application, I created.
-
create or replace PACKAGE foo AS function f1 ( bar in VARCHAR2) return boolean; END; create or replace PACKAGE BODY foo AS function f1 ( bar in VARCHAR2) return boolean IS BEGIN DBMS_OUTPUT.PUT_LINE ('IN FUNCTION F1'); return TRUE; END F1; END;
I have the package above and I want to access package foo variable bar in stand-alone function f2. . How can I achieve this?
create or replace FUNCTION f2 ( p IN VARCHAR) RETURN BOOLEAN IS BEGIN DBMS_OUTPUT.PUT_LINE (foo.bar); DBMS_OUTPUT.PUT_LINE (9); return true; END; I am getting an error Error(5,27): PLS-00302: component 'BAR' must be declared
2779499 wrote:
Oh I mean the bar in parameter to the function f1. I can access in F2?
No, you can't. Variables and objects etc. have 'reach. That means that they exist only in scope, they are declared (so the level they are declared and children procedures/functions etc..). F2 is completely outside f1, so that she can not possibly access this variable or a parameter, as this function f1 is not instantiated, even to the point that running code F2. This isn't just a thing of PL/SQL, it is the principles of almost all of the procedural languages encoding standard.
-
Hi people,
Need help, the example requires that the value of packet data 'g_var' must be updated in the session/s connected everywhere without the session/s to be disconnected and reconnected.
Here's the scenario:I created a table my_table having the pair name / value.
A variable with global package "g_var' in his body and a get accessor method to access g_var variable from the outside world.
This variable g_var is initialized within the block of the entry into force of the package and retrieves the current value of the variable from my_table.
When I update the value in the table a trigger on my_table would reset the State of the package and therefore g_var to the most recent value in the same session
All is well so far since the change in value is reflected in the current session, but if I've already connected session/s
and I'm trying to retrieve the value of "g_var", it is not updated in already connected sessions and remains the same before the update.
Can U help please how can I update this value in a session/s connected without having to disconnect and reconnect.
because if I disconnect and reconect the existing sessions, it seems to show the updated value.Thanks in advance.
Kind regards
Gaurav RajputHere are the Scripts:
drop table my_table;
create table my_table
(
my_variable_name varchar2 (100),
number of my_variable_value
);create or replace package my_package as
Function get_g_var return number;
end my_package;
/create or replace package body my_package as
number of g_var;
Function get_g_var return number is
Start
Return g_var;
exception
while others then
lift;
end get_g_var;
procedure init (my_passed_name varchar2) is
Start
Select my_variable_value in the g_var from my_table where my_variable_name = my_passed_name;
exception
while others then
raise_application_error (-20004, "I got an error during Init");
end init;Start
init ('$'); -This is a call to time when the package is loaded into the memory of session
exception
while others then
raise_application_error (-20003, 'Error in my_package');
end my_pACkage;/
create or replace TRIGGER my_trigger
BEFORE DELETE OR UPDATE
ON my_table
FOR EACH LINE
declare
number of my_ret;
Start
DBMS_SESSION.modify_package_state (DBMS_SESSION. RESET);
exception
while others then
lift;
end my_trigger;/
-It is initially set to null
insert into my_table values ('DOLLAR', 62);
commit;-test value for first time to package loading (62 views)
Select * from my_table;Set serveroutput on
declare
my_variable varchar2 (100);
BEGIN
my_variable: = my_package.get_g_var;
dbms_output.put_line ($my_var);
END;-run the same block of end to start in another session it shows 62. All is well so far
-check if the value after the update in the same session (shows 38), also check in another before the connected session as well (shows 62 and not 38)
Update my_table set my_variable_value = 38 where my_variable_name = "DOLLAR";
commit;Select * from my_table;
Set serveroutput on
-It displays 38 in this session, but there in an already connected session 62 and only after you log out shows 38
declare
my_variable varchar2 (100);
BEGIN
-my_variable: = my_package.g_var;
my_variable: = my_package.get_g_var;
dbms_output.put_line ($my_var);
END;Package variables are stored in the private memory (PGA). The value is not visible in the session. A package variable is therefore not approach appropriate to your problem. You can look at in the context of the Application, as Solomon has said.
http://docs.Oracle.com/CD/B28359_01/network.111/B28531/app_context.htm#CIHFJHCG
-
How to store the values of variable level OBIEE presentation in DB
Hi all!
We have a command prompt of dashboard which is set up to store values in variables of presentation (period start and period end dates). Is there a way to store values selected from a database? for further processing?
that is, I need to pass the variable level (report parameters) presentation to complex calculations to a PL/SQL function.
Also my requirement might be solved if I can get access to the selected values of logical column in the tab 'Business Model and mapping' definition in the BI administrator.
that is, I'll be able to define the logical column using VALUEOF (NQ_SESSION. < nom_var >)
Kind regards
Mr.MaverickHello.
1 do SQL PL/function (in the database) which has an input parameters, which number depends on number of guests and in it you'll insert these parameters into a table.
2. your report in column expression answers call this function that will do insert, the code would be like:
EVALUATE ("YOUR_FUNCTION (1%, 2%, 3%, 4%) (' as varchar (20), @{p_1}, @{p_2}, @{p_3}, @{p_4})3. Note that the function returns something and be careful on data types inside EVALUATE it.
4. notes that, in the case where some messages are not selected (all or nothing) you recognize this case as:
-case when LENGTH('@{pv_var}') > 0 then ' @{pv_var}' end else' all '.
or like this:
-case when LENGTH('@{pv_var}') is null then 'all choice"other" @{pv_var}' end; "
Kind regards
Goran
http://108obiee.blogspot.com -
"Unknown error" whenever I try to access the properties of the network connection
Hi all
whenever I try to access the properties of a network connection (e.g. via right click on 'Network'-> properties-> right click on a connection-> properties), type of connection according to what is, I get a message "Unknown error" box and I can't move forward.
As a result, any setting of any network connection is not editable, more. For example, I wanted to force the IP of the local network of "assigned to DHCP" to "static" with an address fixed IP, but I can't.
Another weird thing is that I even can't delete one of the existing network connections, even if there are a couple that are not in use for a long time...
It should be noted that, apart from that, the network of connections work.
What can cause this behavior, and that might be the way to solve the problem?
I want to upgrade the system to SP3 but I am reluctant to take the plunge with such an "alive"... error
As you may have already guessed, the system is running XP SP2.Thanks in advance,
Concerning
Yes, I am facing the same problem too. The error message says "an unexpected error has occurred." This problem started out with me a few weeks back and I was under the assumption that it was due to a virus attack. But even after a thorough cleaning session problem continues to exist.
The problem - as mentioned above by the Bell, we can neither open the properties of a connection (i.e. Dial-up/LAN/WLAN), or remove or add a new connection. If you try to open the connection properties, all you get is the message "an unexpected error has occurred" and if you try to delete or add a connection - the system does not respond!
Surely, this link worked for me. I hope it works for you Bell. Check it out.
http://wdbuc.com/blog/2010/02/03/an-unexpected-error-occurred-when-you-right-click-on-a-network-connection-in-Windows-XP/
-
I can't connect to the Internet via the wireless network. It shows that I have local access only. I can't connect even in SafeMode with network. I have Ping www.microsoft.com and the answer is "ping request could not find host www.microsoft.com. I am connected to the network wireless through my iPad and can connect via my smartphone. This leads me to believe there is only something configured properly on my laptop. Can anyone provide assistance?
Hello
You can try a system restore...
http://Windows.Microsoft.com/en-us/Windows-Vista/system-restore-frequently-asked-questions
.. .choose time, until this problem (you may tick to show more older restore points).
Tricky
-
I deleted my dial-up access and now I can't connect to internet
I have removed my dial-up access
I deleted my dial-up access and now I can't connect to the internet, how can I get that back
Hello
1. how exactly did you remove the dial-up access?
Method 1:
If you have removed the dial from the network and sharing Center, then it should be detected automatically once you restart the computer.
You can also check the link provided below for more information on the implementation of an incoming VPN or dial-up connection
Set up an incoming VPN or dial-up connection
http://Windows.Microsoft.com/en-us/Windows-Vista/set-up-an-incoming-VPN-or-dial-up-connectionMethod 2:
Perform the system restore. You can restore the computer to a date and time when there are no problems with dial-up access.
Click on the link provided below for more information on restoring the system.
What is system restore?
http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-system-restoreSystem Restore: frequently asked questions
http://Windows.Microsoft.com/en-us/Windows-Vista/system-restore-frequently-asked-questions -
No volume on the toolbar icon and cannot access the volume level
When the computer stops unexpectedly, I lose volume icon. I can't accdd the volume icon in the control panel check to include the icon on the toolbar. I have sound but I can not access the volume level and have no volume on the toolbar icon
Hello
1. don't you make changes to the computer until the problem occurred?
2 when was the last time it was working fine?
I suggest you try the steps below and check if it helps
Method 1: Try to run fix it from the link below:
System icons do not appear in the notification area in Windows Vista or Windows 7, you must restart the computer
http://support.Microsoft.com/kb/945011
Method 2: Try the following steps to add the volume icon in the taskbar
i. right click on the Start button and then click Properties.
II. click the Notification area.
III. put a check mark on the volume icon.
IV. click apply & OK. Check if you see the volume icon in the taskbar.
Method 3: If the problem persists, try the steps from the link below http://windows7themes.net/volume-icon-missing-in-windows-7-restore-it.html
Hope this information is useful.
-
How to access a variable of any page
I have a variable on the page 1 known. p1_my_var I need to be able to access this variable in any other page, I can do this and if so, how?
CREATE AN element of the apllication in share component
my_variable
with the protection of session state
without restriction
create a process plsql on the page where this p1_my_var is present
immediately present after the calculation and validation
BEGIN
() APEX_UTIL.set_session_state
p_name-online "p1_my_var."
p_value =>: my_variable);
END;
condition
submit button
After that: my_variable value can be used in a different page within the session
-
Access a variable in another layer?
Is there a way to access a variable in another layer?
Example:
Layer 1 expression:
x 1 = v * time;
.....
Expression of layer 2:
something like that
anotherLayerX1 = thisComp.layer("1"). GetVariable (x 1);
thisComp.layer("1"). SetVariable (x 1, anotherLayerX1 + 10);
Nope. The only thing available to other expressions is the value that results.
Dan
-
Can I access a variable form of function outside?
I don't know much about ColdFusion yet. If I declare/cfset a variable inside a function, can I just access this variable directly from anywhere on the. CFM page?
If you define a variable in a function without specify var then Yes, the variable will be accessible on a global scale.
See you soon
Eddie
-
Access to the web IS good connection type for daily use?
Our society has made more than a hundred win2000 desktop VMs and use of thin clients to connect these virtual machines via the web access method,
which is very low cost that VMware view. However, I wonder that web access is a right for this connection of the virtual machines to the scale. something unstable
to get to this type of connection?
It is not a good idea because:
There is a limit of simultaneous connection to access the web and it's a little less than 100
the user is required to login to webaccess, select the right virtual machine and open the console. then connect you to windows... it's just too many steps.
and much more
I suggest you activate remote desktop or VNC in each of desktop computers. Fixed IP address in each virtual desktops
in your workstation, create a connection profile Auto connect (for fixed ip address) when you start upward with the user name and password registered. so all when someone reboot the workstation, a connection will be restored automatically.
iDLE-jAM | SC 2, SC 3 & VCP 4
If you have found this device or any other answer useful please consider useful or correct buttons using attribute points
-
MovieClip accesses a variable that is in a function outside the movieclip
I try to access the variable myParentVariable in the myParentFunction() of the myMovieClip_mc function myMovieClipFunction() MovieClip function.
I know it works if I declare the myParentVariable variable outside of the myParentFunction() but I really don't want to do, any help would be great.
main timeline
//-----------------------------------------------------------------------
myParentFunction();
function myParentFunction (): void
{
var myParentVariable:int = 50;
myMovieClip_mc.myMovieClipFunction ();
}
//-----------------------------------------------------------------------
inside MovieClip (the name of the movie clip is myMovieClip_mc( )
//-----------------------------------------------------------------------
function myMovieClipFunction (): void
{
Attempts to access the variable myParentVariable
trace (MovieClip (root) .myParentVariable);
trace (MovieClip (this.root) .myParentVariable);
trace (MovieClip (parent) .myParentVariable);
trace (MovieClip (this.parent) .myParentVariable);
None of these work!
}
//-----------------------------------------------------------------------
This work , but I don't want the variable outside the function
main timeline
//-----------------------------------------------------------------------
var myParentVariable:int = 50;
myParentFunction();
function myParentFunction (): void
{
myMovieClip_mc.myMovieClipFunction ();
}
//-----------------------------------------------------------------------
inside MovieClip (the name of the movie clip is myMovieClip_mc( )
//-----------------------------------------------------------------------
function myMovieClipFunction (): void
{
trace (MovieClip (root) .myParentVariable);
}
//-----------------------------------------------------------------------
If you declare the variable within the function you have limited its scope of application to be in the service, and nothing outside of the function will be able to determine its value. Being inside the function, it is not a stored either value. It is assigned to the function is not something you can reach and grab the current value. The only way to realize the value of the service, other than the registrant outside the service, is that it be passed as the function return value.
Maybe you are looking for
-
all by checking my email I put my right hand on the keys unknown & accidentally enlarged my fonts... How to shrink them? This happens only on my email, I have done it before & end up on keys to go back, but the police is 1/2 "& this time I"having no
-
Aspire 5742 usb3 now usb2 with windows 10
When 10 Windows (shiny) on Win7 your USB3 cabability is lost, it is up to the USB2 only, because there is no update available from ACER for existing laptops driver. ACER can indicate how to obtain a driver USB3? Thank you in advance.
-
I have an ipod shuffle (first-generation) OLD. My system is Windows XP service pack 3. Computer behaving badly. If for any reason I can't install ITUNES without the error message 7 missing Itunes helper.exe need to reinstall Itunes. I tried many meth
-
ND_SCANCLK_LINE in DAQmx
migrated DAQmx, unexpected behavior at the time of the acquisition and the value. use NI 6013 PCI Card. I have some doubts in the migrated source code. Please check if I'm wrong or not. Old code: Select_Signal (DevNo, ND_PFI_2, ND_IN_CONVERT, ND_HIGH
-
Cant SSH from outside on Ethernet but it can if the Wifi! Help
Thus,. If my SSH server is connected to the router via Wifi, I can connect inside AND outside the network with port forwarding. If the SSH server is on Ethernet, I can SSH connect internally in the local network, but NOT VIA the external network! Mac