Subquery for function parameters
Dear friends
Thanks in advance
I had a strange doubt today. Please solve this problem. Breeding is possible or not? His display error
but in one of the packages that use my application, I found that this way of diving entered parameter using the subquery.
Kindly turns me on in the present.
CREATE or REPLACE function xox (p_in, NUMBER, NUMBER, x_in NUMBER of r_in)
RETURN NUMBER
AS
a NUMBER;
BEGIN
a: = p_in + r_in + x_in;
RETURN a;
END;
-Call using Ref Cursor Xox
DECLARE
a SYS_REFCURSOR;
BEGIN
OPEN to
SELECT *.
FROM (SELECT xox (1, 2, (SELECT 1 FROM DUAL)) FROM DUAL); -Giving parameter x_in using subquery
END;
PL/SQL procedure successfully completed.
But if I invoke this function in an assignment as his error display below:
DECLARE
a NUMBER;
BEGIN
a: = xox (1, 2, (SELECT 1 OF double)); -Error
dbms_output.put_line (a);
END;
PLS-00103: encountered the symbol "SELECT" at the expected in the following way:
DROP FUNCTION xox;
Please explain this. I don't understand what is happening here.
The error here is that you can not run a SELECT statement on a variable plsql assignment operation.
But you can do:
DECLARE
a NUMBER;
BEGIN
SELECT xox (1, 2, (SELECT 1 OF double))
IN one
DOUBLE;
dbms_output.put_line (a);
END;
/
Tags: Database
Similar Questions
-
set the password for the 'parameters' on iphone 5
Y at - it app to set a password for the "parameters" on an iphone 5? My son continues to change some of the parameters,
N ° define a word password on the phone and don't let not your son play with him.
-
Condition of additional results work does not correctly for the parameters
TestStand 2014
Trying to connect a parameter only if the status of the step is "failure" will not save the setting when the step will actually fail. On the other hand, variables with the same State will record very well.
The sequence attached illustrates this. Basically I have a sous-suite that returns a random number and a string as parameters. I use the random number to evaluate against my limits for the test call. I want to save the parameter of string only if the step fails. So I put as an additional result, then assign the condition
Step.Result.Status == "failed".
The data never show on the report.
But when I put a result additional explicit with the same local variable and put the same exact condition it appears on the report when the step fails.
I'm puzzled as to why settings will not open a session to this condition, but additional explicit results work fine with the same State.
Any thoughts?
Thank you
Condition for additional result of the parameter is evaluated before the State sequence is set to failure. The 'out' parameter additional results are evaluated probably just after the code module, so if the status of the step is not changed by the call of code module, then it will always be "Running".
I can see how it would be nice if it worked the way you ask, but keep in mind for input/output parameters it is usually the same expression/variable to both the 'in' and 'out' additional result, so it is important to the time at which the result is recorded. It must be done before calling code module for 'in' settings and after the call of code module to 'out' parameters to reflect the State of the variables to these points in time. I think that the intention is that the additional result for settings must reflect the State of the variables at the point in time immediately right before the call for 'in' settings and immediately after the call to 'out' parameters So if you want to connect under certain conditions a value based on the status (where the State is not changed directly by the code module), with the help of a result extra ordinary as you discovered is probably the best way to go.
Maybe for the parameters we might delay logging to the end, but which may result in a change of behavior if the variable state changes again once before that. If you want us to consider or have another idea for how to handle this better please let us know or maybe post something to the exchange of ideas.
Another possibility is that we could temporarily connect the results before and after the code module, but then not assess the condition to the end and throw the recorded result if the condition is false. Who can still cause a change in behavior although if "Value of Log" expressions have side effects.
Hope this helps clarify things.
-Doug
-
I want to buy photoshop, however as the long version for functions 3d, how I would go about buying the long version?
The only version you can buy is CS6, who is 3 years old and is no longer being updated - link to buy the CS6 via phone http://www.adobe.com/products/cs6.html
The current version is by subscription only - Cloud Plans https://creative.adobe.com/plans
-Special photography Plan includes Photoshop & Lightroom and Bridge & Mobile Lightroom
-
Equivalent of CREATE TABLE syntax for functions?
Hello
I am trying to update my functions with a copy of another data base. Y at - it an equivalent syntax in CREATE TABLE as for functions? Basically, I want to drop my old feature in my dev environment and re-create it with the version on prod. I need to use it in a loop for all functions in prod, if just by using the statement plsql itself will not solve my problem.
Thank you
JohnHi, John,.
Discover the package supplied by Oracle dbms_metadata.
In addition, the source code for procedures, functions and packages is available in user_source, which you can query like this:
SELECT text FROM user_source WHERE name = 'PROC_X' AND type = 'PROCEDURE' ORDER BY line ;
-
[SOLVED] Create ViewObject as placeholder for the parameters of the form
Hello
I posted the following question (JDeveloper 11.1.2.3):
http://StackOverflow.com/questions/14592202/create-ViewObject-as-placeholder-for-form-parameters
Basically, how do you create a ViewObject that can perform validation and harness LOVs, but don't don't don't need to be supported by any source of data?
Is it still the right approach?
Thank you!Hey, Timo.
This can be accomplished without an OA. As far as I can tell, it's the right answer, but this forum does not allow me to choose my own answer as correct, but somehow allows me to report my own post as an abuse. Strange.
Find the property formatted (and selected as correct) answer on StackOverflow: http://stackoverflow.com/a/14611815/59087
# Solution
You have:
-Create a view object to be programmatic, with the desired attributes.
-Configure the view with validation rules object.
-Configure the Module of the Application.
-Create the form on the web page.
-Update the page link to create a new line.# Create object View
Create the view as follows:
1. type Control+n to open the * New Gallery *.
1. search and select * view object *.
1. click on * OK *.
1 set * Package *, * name *, and * display name * properly.
1 set * data * to * programme *.
1. click on * following *.
1. click on * new * and provide a significant attribute name.
1. click on * OK *.
1. Add the remaining attributes.
1. click on * following *.
1 set * Updatable * to * always * all attributes.
1 set * Type * for the appropriate data type.
1. click on * finish *.# Configure Validation rules
Configure the following validation rules:
1. click on the * attributes * tab.
1. Select the desired attribute.
1. click on the * tab Validation rules *.
1. click on the * + * icon in the * section Validation rules *.
1 set it * rule definition * as required.
1. set * error * as required.
1 Repeat to add validation as necessary rules.At this point a view object has been configured and the * list tab of values * can be used to reference LOVs based on a query.
# Configuration Application Module
Configure the module of the application as follows:
1 double-click on the module of the app.
1. Select * model data * tab.
1 Shuttle the object view of * available see items * to * model data *.
1. remove the * 1 * suffix.
1. save the application.Note: If the view object is not visible, restart JDeveloper.
# Create Web Form Page
Create a web page to the form as follows:
1. create a new JSF of the object view page.
1 update the * data controls * see the instance of the view object.
1. drag and drop the view on the page object.
"1. Select * form" ADF form *.
1 check * include submit button *.
1. click on * OK *.The web page is created.
# Update the Page link
Cannot change the attributes of the view object unless there is a 'line' created for the instance of the view object. Creation of this line in memory must occur before the display of the content on the page. Accomplish this as follows:
1 extend the data controls to reveal the view object * operations *.
1 drag * Create * in the facet of footer.
1. Select * ADF button *.
1. right-click on the page.
1. Select * go to Page definition *.
1. click on * + * next * executable *.
1. Select * invokeAction *.
1. click on * OK *.
1. set * id * to: create
1. set * lie * for: create
1. click on OK.
1. the refresh value: * prepareModel *.
1. save all.You can now remove the create"" button.
The validation is applied, and data-driven LOVs can be used.
Published by: Dave.Jarvis on January 30, 2013 11:15
-
Connection to iOS Simulator by Air for iOS parameters
Hello
I tried to connect a Flash AS3 document, intended for the iPhone/iPad, iOS Simulator.
The main reason to test this way is that because of the pixel dimensions doesnot app on the computer screen.
In the air for the parameters of the iOS, I traveled to the iiPhone Simulator.app
After you set the path in this way, I went to the control > test movie > iOS Simulator
The result was this error message:
ID: framework not found UIKit
What I am doing wrong?
Any help is greatly appreciated.
Try this info:
http://helpx.Adobe.com/Flash/using/packaging-applications-air-iOS.html#main-pars_header_1
-
missing namespace for the parameters in the web service call
We try to call a web service developed by Java & XFire. The WSDL is valid for WS - I Basic Profile and it works very well with SoapUI. The query generated automatically by SoapUI is the following:
"" "" "< soapenv:Envelope xmlns:soapenv = ' http://schemas.xmlsoap.org/soap/envelope/ ' xmlns: your =" http://www.example.org/test8/ " xmlns:tes1 =" http://www.example.org/test8 "> "
< soapenv:Header / >
< soapenv:Body >
< your: parameters >
< a >
< tes1:id > 44444444444445 < / tes1:id >
< tes1:b >
< tes1:id >? < / tes1:id >
< / tes1:b >
< /a >
< id >? < /ID >
< / your: parameters >
< / soapenv:Body >
< / soapenv:Envelope >
When we put this in Flex, what we are seeing is that the namespace for the parameters element is missing. We see it in the proxy logs. The server receives this message and parameters is not in namespace, so the server complains that the parameters is missing. We can reproduce this exact behavior by removing namespace in the query with SoapUI.
The question is why flex removes namespace for the element parameters?
We use the literal to the WSDL document, and I paste below. We have been stuck on this for over a week, so if anyone has any suggestions I would be eternally grateful. Thank you
<? XML version = "1.0" encoding = "UTF-8"? >
< wsdl:definitions
' xmlns:SOAP =' http://schemas.xmlsoap.org/wsdl/soap/ "
' xmlns:TNS =' http://www.example.org/test8/ '
' xmlns:WSDL =' http://schemas.xmlsoap.org/wsdl/ '
"container =" http://www.w3.org/2001/XMLSchema "
name = "test8".
targetNamespace =" http://www.example.org/test8/" > "
WSDL: < types >
< xsd: Schema
"targetNamespace =" http://www.example.org/test8/ "
xmlns:Q1 =" http://www.example.org/test8" > "
< xsd: import
schemaLocation = "Test8.xsd."
namespace =" http://www.example.org/test8" > "
< / xsd: import >
< xsd: complexType name = "fooRequestType" >
< xsd: SEQUENCE >
< xsd: ELEMENT
name = "a".
Type = "Q1:A" >
< / xsd: element >
< xsd: ELEMENT
name = "id".
Type = "xsd: String" >
< / xsd: element >
< / xsd: SEQUENCE >
< / xsd: complexType >
< xsd: complexType name = "fooResponseType" >
< xsd: SEQUENCE >
< xsd: ELEMENT
name = "b".
Type = "Q1:B" >
< / xsd: element >
< xsd: ELEMENT
name = "id".
Type = "xsd: String" >
< / xsd: element >
< / xsd: SEQUENCE >
< / xsd: complexType >
< / xsd: Schema >
< / wsdl: types >
< name of the WSDL: message = "fooRequest" >
< wsdl: part
name = "parameters".
Type = "tns:fooRequestType" / >
< / wsdl: message >
< name of the WSDL: message = "fooResponse" >
< wsdl: part
name = "parameters".
Type = "tns:fooResponseType" / >
< / wsdl: message >
< name of wsdl: portType = "Test8" >
< name of wsdl: Operation = "foo" >
< message wsdl: Input = "tns:fooRequest" / >
< message wsdl: output = "tns:fooResponse" / >
< / wsdl: Operation >
< / wsdl: portType >
< wsdl: Binding
name = "Test8SOAP".
Type = "tns:Test8" >
< soap binding:
style = "document".
"transport =" http://schemas.xmlsoap.org/soap/http " / >
< name of wsdl: Operation = "foo" >
WSDL: input >
< use of soap: body = "literal" / >
< / wsdl: Input >
< wsdl: output >
< use of soap: body = "literal" / >
< / wsdl: output >
< / wsdl: Operation >
< / wsdl: Binding >
< wsdl:service name = "Test8" >
< wsdl: port
Binding = "tns:Test8SOAP."
name = "Test8SOAP" >
"" < soap: address location = ' http://www.example.org/test8 ' / >
< / wsdl: port >
< / wsdl:service >
< / wsdl:definitions >
the XSD containing A and B:
<? XML version = "1.0" encoding = "UTF-8"? >
"" "" "" < scheme xmlns = " http://www.w3.org/2001/XMLSchema" targetNamespace = ' http://www.example.org/test8 ' xmlns:tns = ' http://www.example.org/test8 ' elementFormDefault = "qualified" >
< name complexType = 'A' >
<>sequence
< element
name = "id".
Type = "string" >
< / item >
< element
name = "b".
Type = "tns:B" >
< / item >
< / sequence >
< / complexType >
< complexType name = "B" >
<>sequence
< element
name = "id".
Type = "string" >
< / item >
< / sequence >
< / complexType >
< / schema >
The solution seems to be that Flex doesn't support unwrapped no literal document. Flex only supports rpc literal or literal wrapped document. This seems to be because flex adds the name of the xml message method and in the unpacked literal document there is no message name in the soap message.
It took a lot of time to understand this, partly because we did not know exactly what is wrapped meant (there is no option in Eclipse WTP for her, no way to verify no wrapped with a tool, etc.). If Flex said that she did not support unpacking literal document we would have saved ourselves a week or two.
-
Default values for bool parameters?
Looks like the default values for Boolean parameters do not work yet. When I try this:
Boolean useAlpha parameter
<
defaultValue: true;
>;
The checkbox is always also unchecked.It seems that the default values are repeated by the Publisher unless the minValue and maxValue have also been specified. To work around the problem, try the following code:
Boolean useAlpha parameter
minValue: false;
maxValue: true;
defaultValue: true;
>;This is a hack, but it should unlock you.
-
Hierarchical + analysis of query for the parameters of the OU
Hello gurus,
I'm trying for a couple of hours there is a query works as I want.
Our application needs to store settings for our organizational units. These organizational units are generally organized in a hierarchy manner: a high-level unit many units of the child. The settings are stored in another table with 1:1 relationship.
For ease of visualization, here are the data of the organization unit and parameter table in a more visual format:
The application queries the table of parameters to get a parameter value for a given unit.SQL> select * from organization_unit; UNIT_CODE UNIT_NAME PARENT_UNIT_CODE ---------- -------------------- ---------------- 00000 Top level 10 L2 unit #10 00000 10-01 L3 unit #10-01 10 10-02 L3 unit #10-02 10 20 L2 unit #20 00000 20-01 L3 unit #20-01 20 20-02 L3 unit #20-02 20 SQL> select * from org_unit_parameters; UNIT_CODE PARAM1 PARAM2 PARAM3 PARAM4 ---------- -------------------- -------------------- -------------------- -------------------- 00000 Default value Default value Default value {null} 10 {null} Value from 10 Value from 10 {null} 10-01 {null} {null} Value from 10-01 {null} 10-02 {null} {null} {null} Value from 10-02 20 Value from 20 Value from 20 Value from 20 {null} 20-01 {null} Value from 20-01 {null} {null} 20-02 {null} Value from 20-02 {null} {null}
The parameter resolution algorithm is pretty simple: when you query a unit, the applicable parameter is set to the required level. If the parameter is undefined (null) to the required level, the value of the parameter to be returned is defined next in the hierarchy parent. In some rare cases, it can be null if a parameter is not set anywhere from required at the top level.
I made a request that seems to work when querying a unit at a time. It uses hierarchical operators (start by + connect by) with a bit of analytical functions. Here's a test & the raw output example:
Seems pretty good, higher settings are well "propagated" down with the LAST_VALUE function. But, I don't understand why the use of FIRST_VALUE and oppposite command does not give the same result. A little more play with the last query to get the final result of a given unit code:SQL> WITH hierarchy 2 AS 3 ( 4 SELECT ou.unit_code, 5 LEVEL AS lvl 6 FROM organization_unit ou 7 START WITH 8 ou.unit_code = '20-01' 9 CONNECT BY 10 ou.unit_code = PRIOR ou.parent_unit_code 11 ) 12 SELECT h.*, 13 p.param1 AS param1_raw, 14 LAST_VALUE (p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param1_with_last, 15 FIRST_VALUE(p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param1_with_first, 16 p.param2 AS param2_raw, 17 LAST_VALUE (p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param2_with_last, 18 FIRST_VALUE(p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param2_with_first, 19 p.param3 AS param3_raw, 20 LAST_VALUE (p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param3_with_last, 21 FIRST_VALUE(p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param3_with_first, 22 p.param4 AS param4_raw, 23 LAST_VALUE (p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param4_with_last, 24 FIRST_VALUE(p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param4_with_first 25 FROM hierarchy h 26 LEFT JOIN org_unit_parameters p 27 ON h.unit_code = p.unit_code 28 ORDER BY h.lvl DESC; UNIT_CODE LVL PARAM1_RAW PARAM1_WITH_LAST PARAM1_WITH_FIRST PARAM2_RAW PARAM2_WITH_LAST PARAM2_WITH_FIRST PARAM3_RAW PARAM3_WITH_LAST PARAM3_WITH_FIRST PARAM4_RAW PARAM4_WITH_LAST PARAM4_WITH_FIRST ---------- ---- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- 00000 3 Default value Default value Value from 20 Default value Default value Value from 20-01 Default value Default value Value from 20 {null} {null} {null} 20 2 Value from 20 Value from 20 Value from 20 Value from 20 Value from 20 Value from 20-01 Value from 20 Value from 20 Value from 20 {null} {null} {null} 20-01 1 {null} Value from 20 {null} Value from 20-01 Value from 20-01 Value from 20-01 {null} Value from 20 {null} {null} {null} {null}
Works well!SQL> SELECT * 2 FROM 3 ( 4 WITH hierarchy 5 AS 6 ( 7 SELECT ou.unit_code, 8 LEVEL AS lvl 9 FROM organization_unit ou 10 START WITH 11 ou.unit_code = '20-01' 12 CONNECT BY 13 ou.unit_code = PRIOR ou.parent_unit_code 14 ) 15 SELECT h.*, 16 LAST_VALUE (p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param1, 17 LAST_VALUE (p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param2, 18 LAST_VALUE (p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param3, 19 LAST_VALUE (p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param4 20 FROM hierarchy h 21 LEFT JOIN org_unit_parameters p 22 ON h.unit_code = p.unit_code 23 ORDER BY h.lvl 24 ) 25 WHERE ROWNUM = 1; UNIT_CODE LVL PARAM1 PARAM2 PARAM3 PARAM4 ---------- ---- -------------------- -------------------- -------------------- -------------------- 20-01 1 Value from 20 Value from 20-01 Value from 20 {null}
But my ultimate goal is to create a view that properly solve all these parameters for each level of the organization with the good spread rather in new queries for each unit at once. I played a little, but without success. :( My current gross query is the following:
As you can see, it's not that I was expecting. I know there is something to do with a PARTITION BY clause, but do not know how.SQL> WITH hierarchy 2 AS 3 ( 4 SELECT ou.unit_code, 5 LPAD(' ',2*(LEVEL-1)) || ou.unit_code AS tree, 6 LEVEL AS lvl 7 FROM organization_unit ou 8 START WITH 9 parent_unit_code IS NULL 10 CONNECT BY 11 PRIOR unit_code = parent_unit_code 12 ) 13 SELECT h.*, 14 p.param1 AS param1_raw, 15 LAST_VALUE (p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param1_with_last, 16 FIRST_VALUE(p.param1 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param1_with_first, 17 p.param2 AS param2_raw, 18 LAST_VALUE (p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param2_with_last, 19 FIRST_VALUE(p.param2 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param2_with_first, 20 p.param3 AS param3_raw, 21 LAST_VALUE (p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param3_with_last, 22 FIRST_VALUE(p.param3 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param3_with_first, 23 p.param4 AS param4_raw, 24 LAST_VALUE (p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl DESC) AS param4_with_last, 25 FIRST_VALUE(p.param4 IGNORE NULLS) OVER (ORDER BY h.lvl ASC) AS param4_with_first 26 FROM hierarchy h 27 LEFT JOIN org_unit_parameters p 28 ON h.unit_code = p.unit_code 29 ORDER BY h.unit_code; UNIT_CODE TREE LVL PARAM1_RAW PARAM1_WITH_LAST PARAM1_WITH_FIRST PARAM2_RAW PARAM2_WITH_LAST PARAM2_WITH_FIRST PARAM3_RAW PARAM3_WITH_LAST PARAM3_WITH_FIRST PARAM4_RAW PARAM4_WITH_LAST PARAM4_WITH_FIRST ---------- ---------- ---- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- ------------------------- 00000 00000 1 Default value Default value Default value Default value Default value Default value Default value Default value Default value {null} Value from 10-02 {null} 10 10 2 {null} Value from 20 Default value Value from 10 Value from 10 Default value Value from 10 Value from 10 Default value {null} Value from 10-02 {null} 10-01 10-01 3 {null} {null} Default value {null} Value from 20-02 Default value Value from 10-01 Value from 10-01 Default value {null} Value from 10-02 Value from 10-02 10-02 10-02 3 {null} {null} Default value {null} Value from 20-02 Default value {null} Value from 10-01 Default value Value from 10-02 Value from 10-02 Value from 10-02 20 20 2 Value from 20 Value from 20 Default value Value from 20 Value from 10 Default value Value from 20 Value from 10 Default value {null} Value from 10-02 {null} 20-01 20-01 3 {null} {null} Default value Value from 20-01 Value from 20-02 Default value {null} Value from 10-01 Default value {null} Value from 10-02 Value from 10-02 20-02 20-02 3 {null} {null} Default value Value from 20-02 Value from 20-02 Default value {null} Value from 10-01 Default value {null} Value from 10-02 Value from 10-02
Anyone know how to solve my problem?
Thank you
Bruno
For the purposes of reproducibility, here is the code to create the structure and data:
Here is the format of my paintings and a few samble data:CREATE TABLE organization_unit ( unit_code VARCHAR2(5 CHAR) NOT NULL PRIMARY KEY, unit_name VARCHAR2(100 CHAR) NOT NULL, parent_unit_code VARCHAR2(5 CHAR) ); CREATE TABLE org_unit_parameters ( unit_code VARCHAR2(5 CHAR) NOT NULL PRIMARY KEY, param1 VARCHAR2(100 CHAR), param2 VARCHAR2(100 CHAR), param3 VARCHAR2(100 CHAR), param4 VARCHAR2(100 CHAR) ); -- Inserting data INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code) VALUES ('00000', 'Top level', NULL); INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code) VALUES ('10', 'L2 unit #10', '00000'); INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code) VALUES ('10-01', 'L3 unit #10-01', '10'); INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code) VALUES ('10-02', 'L3 unit #10-02', '10'); INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code) VALUES ('20', 'L2 unit #20', '00000'); INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code) VALUES ('20-01', 'L3 unit #20-01', '20'); INSERT INTO organization_unit (unit_code, unit_name, parent_unit_code) VALUES ('20-02', 'L3 unit #20-02', '20'); INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param1, param2, param3) VALUES ('00000', 'Default value', 'Default value', 'Default value'); INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param2, param3) VALUES ('10', 'Value from 10', 'Value from 10'); INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param3) VALUES ('10-01', 'Value from 10-01'); INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param4) VALUES ('10-02', 'Value from 10-02'); INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param1, param2, param3) VALUES ('20', 'Value from 20', 'Value from 20', 'Value from 20'); INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param2) VALUES ('20-01', 'Value from 20-01'); INSERT INTO ORG_UNIT_PARAMETERS (unit_code, param2) VALUES ('20-02', 'Value from 20-02'); COMMIT;
Hi, Bruno.
You almost had it!
Take your query that gets good results for a single node. Remove the START WITH clause so that it does the same thing for each node. You will need to add CONNECT_BY_ROOT to remember what node you started with in each case and PARTITION BY calling value in all the LAST_VALUE function:WITH hierarchy AS ( SELECT ou.unit_code AS ancestor_unit_code, LEVEL AS lvl, CONNECT_BY_ROOT ou.unit_code AS descendant_unit_code FROM organization_unit ou CONNECT BY ou.unit_code = PRIOR ou.parent_unit_code ) , got_params AS ( SELECT h.descendant_unit_code AS unit_code , h.lvl , LAST_VALUE (p.param1 IGNORE NULLS) OVER ( PARTITION BY h.descendant_unit_code ORDER BY lvl DESC ) AS param1 , LAST_VALUE (p.param2 IGNORE NULLS) OVER ( PARTITION BY h.descendant_unit_code ORDER BY lvl DESC ) AS param2 , LAST_VALUE (p.param3 IGNORE NULLS) OVER ( PARTITION BY h.descendant_unit_code ORDER BY lvl DESC ) AS param3 , LAST_VALUE (p.param4 IGNORE NULLS) OVER ( PARTITION BY h.descendant_unit_code ORDER BY lvl DESC ) AS param4 FROM hierarchy h LEFT OUTER JOIN org_unit_parameters p ON h.ancestor_unit_code = p.unit_code ) SELECT unit_code, param1, param2, param3, param4 FROM got_params WHERE lvl = 1 ;
Output:
NIT_ PARAM1 PARAM2 PARAM3 PARAM4 ----- ---------------- ---------------- ---------------- ---------------- 00000 Default value Default value Default value 10 Default value Value from 10 Value from 10 10-01 Default value Value from 10 Value from 10-01 10-02 Default value Value from 10 Value from 10 Value from 10-02 20 Value from 20 Value from 20 Value from 20 20-01 Value from 20 Value from 20-01 Value from 20 20-02 Value from 20 Value from 20-02 Value from 20
I hope that's what you want. I don't see the exact results you wanted posted anywhere.
Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.
The difference between LAST_VALUE (... DESC) and FIRST_VALUE (... CSA) has to do with the default windowing.
Say that we try to calculate FIRST_VALUE and LAST_VALUE on a line where lvl = 1, and it has 2 and 3 lvls in the same partition.
LAST_VALUE (... ORDER BY DESC lvl) means the window includes lvl = values 1 and all the highest (i.e., 2 and 3).
FRIST_VALUE (...) ORDER BY DESC lvl) means the window includes lvl = 1 and all the values (which, of course, their absence)
It is because the widow of default is BETWEEN UNBOUNDED PREVIOUS AND CURRENT ROW, where "preceding" means lower values if you use ascending order, but higher values if you use descending order. We could use FIRST_VALUE to get the same results, but we will have to explicitly set the window in BETWEEN CURRENT_ROW AND UNBOUNDED FOLLOWING.Published by: Frank Kulash, November 12, 2010 12:46
Additional explanation of LAST_VALUEPublished by: Frank Kulash, November 12, 2010 13:04
Beheading has been corrected. -
Help with the name of the comparison of the output of an sql subquery value function
Oracle 10 g
The problem is I want to compare the value obtained from the subquery with the next value in the values of the column from the main query
Add a view called bioChemCompare to show the content average A-level biology and in the average grade of A-level chemistry for students of each school that has an average GCSE score between 6.5 and 7.0 (inclusive). The
calculations should be carried out only on students who studied BOTH the biology and chemistry of A'level.
I have a query like
The subqueryselect g.grade from comqdhb.gradevalues@glink g where g.value > ( select avg(g.value) from comqdhb.gradevalues@glink g , comqdhb.subject@glink sb , comqdhb.studentingroup@glink sg , comqdhb.teachinggroup@glink tg , comqdhb.student@glink s , average_gcse gc where g.grade=sg.grade and gc.avg_gcse between 6.5 and 7 and gc.upn=s.upn and g."LEVEL"='a' and sb.sid=tg.sid and sg.gid=tg.gid and sg.upn=s.upn and (sb.subject ='Biology' or sb.subject='Chemistry'));
Returnsselect avg(g.value) from comqdhb.gradevalues@glink g , comqdhb.subject@glink sb , comqdhb.studentingroup@glink sg , comqdhb.teachinggroup@glink tg , comqdhb.student@glink s , average_gcse gc where g.grade=sg.grade and gc.avg_gcse between 6.5 and 7 and gc.upn=s.upn and g."LEVEL"='a' and sb.sid=tg.sid and sg.gid=tg.gid and sg.upn=s.upn and (sb.subject ='Biology' or sb.subject='Chemistry')
In the main query78.88
g.Value has values such asselect g.grade from comqdhb.gradevalues@glink g where g.value > 78.8
78.8 is close to 80, only 80 must be taken and the corresponding grade will be displayed.120 100 80 60 40 20
What is the function to do so.
I just put > and it displays
120 A
100 B
80 C
But the ABC should not be visible only C must be taken
y at - it no fuction as neighbors, cant use between
Please help, thank you.Rider wrote:
y at - it no fuction as neighbors, cant use betweenThe MIN function maybe aggregation?
select min(g.grade) from comqdhb.gradevalues@glink g ...
Kind regards
Rob. -
Omen: Lost fn / esc and fn for the parameters of the Omen
Hello
I lost my fn and esc function and also the fn and settings profile for control of lighting Omen. The fn and other functions work well for example fn and brightness / volume / etc.
I tried re loading driver keyboard and control omen without effect.
Is it just a touch or make me more harm?
Thank you
Liam
Thanks for your suggestions, I solved it by doing a system recovery.
-
SatelliteA205 - player for the top menu with shortcuts for functions (Fn)
Hello
I have a Satellite A205-S4797 and I installed Vista Business (Pt_Br).
Even with the drivers for Vista, I can not install the top menu with shortcuts to functions (Fn).Is there a specific driver for this version of Vista (Pt_Br)?
If you write on flash cards that you need to install the package of added value. This package contains several tools and utilities, and one of them is for flash cards.
Please check the Toshiba download page and see if the VAP is listed.
-
Feature Request: 1-2: option report l / h for function of "marker".
Hello Peter et al.,.
I would like to request a report l option / additional: for the function of "marker" in the cameras: 2 / 1 (or 'Univisium' as I think marked Storaro).
He sees public use in the House of cards at the moment, and I turns a lot of work at present mainly (for TV broadcast and web) that goes from 2:1 for a more cinematic look who uses 16:9 screens classic a little more effectively than ratios correct widescreen/cinemascope.
I know there are a ton of extensions already available, but 2:1 seems to be quickly gaining popularity, and it would be great to be able to compose a little more precisely using function "marker" of the camera and the actual report.
See you soon,.
Mark
Menu > VF > marker
Then you will see that several settings marked "User box" that control the position, height, and width.
Those where you need. Then select: User box > WE
See you soon!
-
I liked to use software Photo Editor for "Resize" function it was very easy, now I find not anywhere to download Photo Editor for free, can you help me?
(why was editor-in-Chief picture removed)
Or any other suggestions for "resize photos?
The following preferential ticket may be worth a try:
(FWIW... it's always a good idea to create a system)
Restore point before installing software or updates)Image Resizer (PowerToy Clone)
http://ImageResizer.codeplex.com/releases/view/30247
(Windows XP, Vista, 7)After that the resizer is installed there will be a link to resize
in your right click menu.Another possibility
Light Image Resizer (also accessible via the right click menu):
http://www.ObviousIdea.com/Windows-software/light-image-resizer/
(Windows 7, Windows Vista, Windows XP SP2, 32-bit or 64-bit)
Light Image Resizer - how to resize a Photo
http://www.ObviousIdea.com/Windows-software/light-image-resizer/how-to-resize-a-photo/
Maybe you are looking for
-
Hi all We run server 2012 and a Kyocera 7500task alfa installed with the latest printer driver KX last 6.3.909 For the past two weeks every morning even before that people are at the office, we get some random pages printed on the printer that looks
-
Upgrade Windows 7 Pro 32 bit to Windows 7 Pro 64-bit
I bought Windows 7 Pro (32 bit) a year ago and I got a disk, the disk of 32 bits, with my purchase. So my question is, how do I upgrade to a 64 bit version of Windows 7 Professional? I heard that there is a chance that I could have someone (Microsoft
-
Smartphones blackBerry 9800 torch
trying to access the text messages and I get java untrapped exception. lang.index off-limits exception. can someone help me
-
Placement of external antennas SRI 1941 WIFI-AP
Hello! We have 1941 SRI with builtin WiFi-AP that uses three antennas. I want to cover three floors with this access point using external antennas to separate floors. The left and the right antennas can be used for transmission and reception and comm
-
Your application is damaged please uninstall
Hello, I use a PC. I downloaded Creative Cloud and then try to download illustrator, but each time it installs the error in my application is damaged reappear. I have uninstalled and reinstalled four times before you decide to post in the forum help?