Return two values from autosuggest

hi i have inputtext with autosuggest,i what to return two values when i select the values for example if i select cityname i must return cityname and citypostacode for that city.this is how i did my inputtext autosuggest
<af:inputText label="#{bindings.Cityname.hints.label}" columns="20"
                                        maximumLength="#{bindings.Cityname.hints.precision}"
                                        id="itc4" simple="true"
                                      value="#{pageFlowScope.orgDetailsBean.addressBean.city}"
                                      partialTriggers="it19" autoSubmit="true"
                                      shortDesc="Enter City Name Or Click Refresh To re-enter City Name">
                            <af:autoSuggestBehavior suggestedItems="#{pageFlowScope.addressbean.oncitySuggest}"/>
                        <af:autoSuggestBehavior/>
                      </af:inputText>
    public List oncitySuggest(String searchCityName) {
    ArrayList<SelectItem> selectItems = new ArrayList<SelectItem>();
        searchCityName = searchCityName.toUpperCase();
    System.out.println(searchCityName);
    //get access to the binding context and binding container at runtime
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentBindingsEntry();
    //set the bind variable value that is used to filter the View Object
    //query of the suggest list. The View Object instance has a View
    //Criteria assigned
    OperationBinding setVariable = (OperationBinding) bindings.get("setBind_city");
    setVariable.getParamsMap().put("value", searchCityName);
    setVariable.execute();
    //the data in the suggest list is queried by a tree binding.
    JUCtrlHierBinding hierBinding = (JUCtrlHierBinding) bindings.get("CityViewLOV1");
    //re-query the list based on the new bind variable values
    hierBinding.executeQuery();
    //The rangeSet, the list of queries entries, is of type
    //JUCtrlValueBndingRef.
    List<JUCtrlValueBindingRef> displayDataList = hierBinding.getRangeSet();
    for (JUCtrlValueBindingRef displayData : displayDataList){
    Row rw = displayData.getRow();
    //populate the SelectItem list
    selectItems.add(new SelectItem(
    (String)rw.getAttribute("Cityname"),
    (String)rw.getAttribute("Boxcode"),
    (String)rw.getAttribute("Citycode")));
    return selectItems;
    }

KK-$$ wrote:
Now I need 1 more column say, flag something like:
open o_ref_cursor for select function_name( 2345) Emp_no ,  function_name_2 ( 2345) flag from table1 where x = y;But I don't want to define a new function function_name_2 to get flag value. Because emp_no and flag are both queried from the same table.
So, Can you tell me how can I make 'function_name' to return two values using appropriate data-type ( or user defined data type?)?Your example could be solved like this (since it is in pl/sql):
v_emp_no := function_name( 2345);
v_flag := function_name_2 ( 2345);
open o_ref_cursor for select v_emp_no Emp_no , v_flag flag from table1 where x = y;But I guess the example was still too simplicistic.

Similar Messages

  • How do I return two values from a stored procedure into an "Execute SQL Task" within SQL Server 2008 R2

    Hi,
    How do I return two values from a
    stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
    Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
    Something like ?
    CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
    @intPeriod INT,
    @strPeriod_Length NVARCHAR(1),
    @dtStart NVARCHAR(8) OUTPUT,
    @dtEnd NVARCHAR(8) OUTPUT
    AS
    then within the SSIS component; -
    Kind Regards,
    Kieran. 
    Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/

    Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
    Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
    Add a script task to check ssis variables values using,
    Msgbox(Dts.Variables("User::strExtractStartDate").Value)
    Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
    Regards, RSingh

  • I Need to Return Two values or more from Function, Is this possible?

    Below is the offending query, I am trying to pass v_bu and v_po to this function, and after validations then return v_count and v_action is this possible in a function? I am having problem returning two values.
    see below code
    function po_edi_func(v_bu purchase_order.business_unit_id%type,
         v_po purchase_order.purchase_order_number%type)
         return number as pragma autonomous_transaction;
         v_count               number;
         v_ctdel               number;
         v_action          varchar2(1);
    begin
    select count(*)
    into v_count
    from sewn.purchase_order
    where business_unit_id=v_bu
    and purchase_order_number =v_po;
    if v_count > 0 then
         select count(*)
         into v_ctdel
         from sewn.purchase_order
         where business_unit_id=v_bu
    and purchase_order_number =v_po
         and purc_orde_status = 1;
         if v_count <> v_ctdel then -- ALl PO's Cancelled--
         v_action := 'U'; -- - NOT ALL PO DELETED --
         else
         v_action := 'D'; -- DELETED ALL PO--
         end if;
    else
         v_action := 'I';-- New PO INSERT--
    end if;
    commit;
    return v_count;
    end;

    Paul,
    This is becoming a nightmare to me, can you look at the below and tell me where I am having a problem
    This is the Function below
    CREATE OR REPLACE function po_edi_func(v_bu sewn.purchase_order.business_unit_id%type,
         v_po sewn.purchase_order.purchase_order_number%type,v_action_out OUT VARCHAR2)
         return number as pragma autonomous_transaction;
         v_count               number;
         v_ctdel               number;
         v_action          varchar2(1);
    begin
    select count(*)
    into v_count
    from sewn.purchase_order
    where business_unit_id=v_bu
    and purchase_order_number =v_po;
    if v_count > 0 then
         select count(*)
         into v_ctdel
         from sewn.purchase_order
         where business_unit_id=v_bu
    and purchase_order_number =v_po
         and purc_orde_status = 1;
         if v_count <> v_ctdel then -- ALl PO's Cancelled--
         v_action := 'U'; -- - NOT ALL PO DELETED --
         else
         v_action := 'D'; -- DELETED ALL PO--
         end if;
    else
         v_action := 'I';-- New PO INSERT--
    end if;
    commit;
    v_action_out := (lpad(v_count,8,'0')||lpad(v_action,1,' '));
    return v_action_out;
    end;
    and this is how I am calling it from my trigger which has to pass the v_bu and v_po values to be used in extracting data and returning the records
    see below
    if po_edi_func(v_bu,v_po) <> '' then;
    v_count:= (substr(v_action,1,8));
    v_action := substr(v_actione,9,1);
    else
    v_count:=0;
    v_action := 'I';
    end if;
    I need the extracted values of v_count and v_action for my app to reset some values

  • Return multiple values from a method

    For a school project I have to make a parameter-less constructor that can input values from the keyboard and calculate those values. Now that I have the values how do I return them? I need to return 3 values from this parameter-less method.
    I hoope someone can help.

    Qwertyfshag wrote:
    Here is the wording of the assignment. I have copied and pasted it word for word:
    "Declare and use a no-argument (or "parameter-less") constructor to input the data needed, and to do the calculations."
    Any advice???Find a teacher who isn't an idiot. That sentence is vague ("to input the data needed"? Does that mean that it's supposed to query the user (which is terrible) or that it's supposed to encapsulate the data as hardcoded values, or what?) and is a bad design. Constructors shouldn't do this sort of thing.
    Ok I have done that part and now I want to retrieve the values of the calculations. How can I get those values out of that method What do you mean "that method"? Constructors aren't methods, and they don't return values.
    I suppose you could define a class whose constructor queries the user, and which would have a method to return values. That could be pretty simple; the method signature would be like this:
    Set<Integer> getValues();
    This seems like an advanced problem.It's not advanced; it's just garbage.
    I can't post the code in hear because that may constitute cheating. I am allowed to discuss it verbally but I cannot share code, sorry.You can't get a lot of help then. We can't psychically see what you've done so far.
    In conclusion: I have to have two methods. One method is a constructorConstructors aren't methods. If your teacher told you that they are, then he/she doesn't know what he/she is doing.
    that has NO parameters that will get input from the keyboard (done) and do the calculations (done). The other method must print that values to the screen on separate lines (not done). I don't know how to get the values out of the method.If they're two methods in the same class, then the constructor just needs to store the user input into a field of the class, and the other method can read the values in that field.

  • Returning a value from a LOV to the main document

    Hi,
    I'm using jheadsrart with uix, I have a form with a LOV. When I chose a value in the LOV, I need to return another value from that LOV to a hidden field in my main document.
    How can I do that?
    Thanks for your help!
    Martin

    Hi Rohit,
    Just declare the two variables var1(variable for checking data) & var2(variable for counter) in your include program.
    Inside the include you can do the coding as under:
    IF VAR1 <condition for checking data>.
    VAR2 = VAR2 + 1.
    ENDIF.
    Now you can check the value of the variable VAR2 in the main program & call the desired function.
    Regards,
    Chetan.
    PS:Reward points if this helps.

  • Two values from a LOV to Timecard LDT

    Hi,
    I have a requirement to pull two values from single LOV to Timecard layout page.
    e.g.: Suppose we have a LOV field 'emp_number' on layout and this field is getting value from one LOV. Query in LOV shows emp_number and emp_last_name. I want to put one more field on layout page by the name Last_Name and whenever a emp_number value is selected in LOV, corresponding emp_last_name value should be coming to Last_Name field of layout page. Can somebody please help me on how to do this?
    I have tried to add one similar HXC_LAYOUT_COMPONENTS as of Emp_number LOV field to ldt file with component = 'Text_Field' but it is not working for me :(

    Follow this note 307151.1, this note describes how to populate a Task Name in a different field when Task number is selected in LOV, you have a similar requirement, so you can configure the attributes as described in that note.
    - Ramu

  • [UIX] How To: Return multiple values from a LOV

    Hi gang
    I've been receiving a number of queries via email on how to return multiple items from a LOV using UIX thanks to earlier posts of mine on OTN. I'm unfortunately aware my previous posts on this are not that clear thanks to the nature of the forums Q&A type approach. So I thought I'd write one clear post, and then direct any queries to it from now on to save me time.
    Following is my solution to this problem. Please note it's just one method of many in skinning a cat. It's my understanding via chatting to Oracle employees that LOVs are to be changed in a future release of JDeveloper to be more like Oracle Forms LOVs, so my skinning skills may be rather bloody & crude very soon (already?).
    I'll base my example on the hr schema supplied with the standard RDBMS install.
    Say we have an UIX input-form screen to modify an employees record. The employees record has a department_id field and a fk to the departments table. Our requirement is to build a LOV for the department_id field such that we can link the employees record to any department_id in the database. In turn we want the department_name shown on the employees input form, so this must be returned via the LOV too.
    To meet this requirement follow these steps:
    1) In your ADF BC model project, create 2 EOs for employees and departments.
    2) Also in your model, create 2 VOs for the same EOs.
    3) Open your employees VO and create a new attribute DepartmentName. Check “selected in query”. In expressions type “(SELECT dept.department_name FROM departments dept WHERE dept.department_id = employees.department_id)”. Check Updateable “always”.
    4) Create a new empty UIX page in your ViewController project called editEmployees.uix.
    5) From the data control palette, drag and drop EmployeesView1 as an input-form. Notice that the new field DepartmentName is also included in the input-form.
    6) As the DepartmentName will be populated either from querying existing employees records, or via the LOV, disable the field as the user should not have the ability to edit it.
    7) Select the DepartmentId field and delete it. In the UI Model window delete the DepartmentId binding.
    8) From the data controls palette, drag and drop the DepartmentId field as a messageLovInput onto your page. Note in your application navigator a new UIX page lovWindow0.uix (or similar) has been created for you.
    9) While the lovWindow0.uix is still in italics (before you save it), rename the file to departmentsLov.uix.
    10) Back in your editEmployees.uix page, your messageLovInput source will look like the following:
    <messageLovInput
        model="${bindings.DepartmentId}"
        id="${bindings.DepartmentId.path}"
        destination="lovWindow0.uix"/>Change it to be:
    <messageLovInput
        model="${bindings.DepartmentId}"
        id="DepartmentId"
        destination="departmentsLov.uix"
        partialRenderMode="multiple"
        partialTargets="_uixState DepartmentName"/>11) Also change your DepartmentName source to look like the following:
    <messageTextInput
        id=”DepartmentName”
        model="${bindings.DepartmentName}"
        columns="10"
        disabled="true"/>12) Open your departmentsLov.uix page.
    13) In the data control palette, drag and drop the DepartmentId field of the DepartmentView1 as a LovTable into the Results area on your page.
    14) Notice in the UI Model window that the 3 binding controls have been created for you, an iterator, a range and a binding for DepartmentId.
    15) Right click on the DepartmentsLovUIModel node in the UI Model window, then create binding, display, and finally attribute. The attribute binding editor will pop up. In the select-an-iterator drop down select the DepartmentsView1Iterator. Now select DepartmentName in the attribute list and then the ok button.
    16) Note in the UI Model you now have a new binding called DCDefaultControl. Select this, and in the property palette change the Id to DepartmentName.
    17) View the LOV page’s source, and change the lovUpdate event as follows:
    <event name="lovSelect">
        <compound>
            <set value="${bindings.DepartmentId.inputValue}" target="${sessionScope}" property="MyAppDepartmentId" />
            <set value="${bindings.DepartmentName.inputValue}" target="${sessionScope}" property="MyAppDepartmentName" />
        </compound>
    </event>18) Return to editEmployees.uix source, and modify the lovUpdate event to look as follows:
    <event name="lovUpdate">
        <compound>
            <set value="${sessionScope.MyAppDepartmentId}" target="${bindings.DepartmentId}" property="inputValue"/>
            <set value="${sessionScope.MyAppDepartmentName}" target="${bindings.DepartmentName}" property="inputValue"/>     
        </compound>
    </event>That’s it. Now when you select a value in your LOV, it will return 2 (multiple!) values.
    A couple things to note:
    1) In the messageLovInput id field we don’t use the “.path” notation. This is mechanism for returning 1 value from the LOV and is useless for us.
    2) Again in the messageLovInput we supply “_uixState” as an entry in the partialTargets.
    3) We are relying on partial-page-refresh functionality to update multiple items on the screen.
    I’m not going to take the time out to explain these 3 points, but it’s worthwhile you learning more about them, especially the last 2, as a separate exercise.
    One other useful thing to do is, in your messageLovInput, include as a last entry in the partialTargets list “MessageBox”. In turn locate the messageBox control on your page (if any), and supply an id=”MessageBox”. This will allow the LOV to place any errors raised in the MessageBox and show them to the user.
    I hope this works for you :)
    Cheers,
    CM.

    Thanks Chris,
    It took me some time to find the information I needed, how to use return multiple values from a LOV popup window, then I found your post and all problems were solved. Its working perfectly, well, almost perfectly.
    Im always fighting with ADF-UIX, it never does the thing that I expect it to do, I guess its because I have a hard time letting go of the total control you have as a developer and let the framework take care of a few things.
    Anyway, I'm using your example to fill 5 fields at once, one of the fields being a messageChoice (a list with countries) with a LOV to a lookup table (id , country).
    I return the countryId from the popup LOV window, that works great, but it doesn't set the correct value in my messageChoice . I think its because its using the CountryId for the listbox index.
    So how can I select the correct value inside my messageChoice? Come to think of it, I dont realy think its LOV related...
    Can someone help me out out here?
    Kind regards
    Ido

  • Returning several values from a C native method

    Hi,
    I need to return 3 values from a native methode : an int (the return code), a string of variable length and a double.
    In pure C, my function would be defined as "int f ( char* s, double* d)", and I would "malloc" the string into the calling function, then copy my string to "s" and use "*d" to return the double...
    Is there a way to do that with JNI? I found some examples where the native function returns only one parameterlike: "return(*env)->NewStringUTF(env, buffer);" But I didn't find examples where the native function returns several parameters, including a string.
    Thanks in advance!
    JM

    This really has nothing to do with JNI.
    You have a method, and you want to return more than one type of value.
    The following solutions are possible.
    1. Return an array that contains all the values (actual return value.)
    2. Return an object that contains all the values (actual return value.)
    3. Use an array via the parameter list and fill in a value.
    4. Use an object via the parameter list and fill in the values.

  • How to return multiple values from dialog popup

    hi all
    I'm using ADF 10g. I have a requirement that I have to return multiple values from a dialog.
    I have a page containing a table with a button which calls the dialog. The dialog contains a multi-select table where i want to select multiple records and add them to the table in the calling page.
    In the backing bean of the calling page, I have the returnListener method.
    I am thinking that I have to store the selected rows from dialog in an array and return that array to the returnListener...but I don't know how to go about it with the code.
    Can someone help me out with it?
    thanks

    Hi Frank,
    I'm trying to implement your suggestion but getting comfused.
    AdfFacesContext.getCurrentInstance().returnFromDialog(null, hashMap) is called in ActionListener method, from what I understood.
    ReturnListener method already calls it, so no need to call explicitly.
    Okay here's what i'm doing.
    command button launches the dialog on the calling page.
    In the dialog page, there is a button "select", which when i click, closes the dialog and returns to calling page. I put a af:returnActionListener on this button, which logically should have a corresponding ReturnListener() in the calling page backing bean.
    Now I have 3 questions:
    1. do i have to use ActionListener or ReturnListener?
    2. where do I create the hashMap? Is it in the backing bean of the dialog or in the one of calling page?
    3. how do I retrieve the keys n values from hashmap?
    please help! thanks
    This is found in the backing bean of calling page:
    package mu.gcc.dms.view.bean.backing;
    import com.sun.java.util.collections.ArrayList;
    import com.sun.java.util.collections.HashMap;
    import com.sun.java.util.collections.List;
    import java.io.IOException;
    import java.util.Map;
    import javax.faces.application.Application;
    import javax.faces.application.ViewHandler;
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.FacesContext;
    import javax.faces.el.ValueBinding;
    import javax.faces.event.ActionEvent;
    import mu.gcc.dms.model.services.DMSServiceImpl;
    import mu.gcc.dms.model.views.SiteCompaniesImpl;
    import mu.gcc.dms.model.views.SiteCompaniesRowImpl;
    import mu.gcc.dms.model.views.lookup.LkpGlobalCompaniesImpl;
    import mu.gcc.util.ADFUtils;
    import mu.gcc.util.JSFUtils;
    import oracle.adf.model.BindingContext;
    import oracle.adf.model.binding.DCBindingContainer;
    import oracle.adf.model.binding.DCIteratorBinding;
    import oracle.adf.view.faces.context.AdfFacesContext;
    import oracle.adf.view.faces.event.ReturnEvent;
    import oracle.adf.view.faces.model.RowKeySet;
    import oracle.binding.AttributeBinding;
    import oracle.binding.BindingContainer;
    import oracle.binding.OperationBinding;
    import oracle.jbo.AttributeDef;
    import oracle.jbo.Key;
    import oracle.jbo.Row;
    import oracle.jbo.RowIterator;
    import oracle.jbo.RowSetIterator;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.java.util.Iterator;
    public class CompanyList {
    private BindingContainer bindings;
    private Map hashMap;
    DMSServiceImpl service =(DMSServiceImpl)ADFUtils.getDataControlApplicationModule("DMSServiceDataControl");
    SiteCompaniesImpl siteCompanyList = service.getSiteCompanies();
    LkpGlobalCompaniesImpl globalCompanyList = service.getLkpGlobalCompanies();
    public CompanyList() {
    public BindingContainer getBindings() {
    return this.bindings;
    public void setBindings(BindingContainer bindings) {
    this.bindings = bindings;
    *public void setHashMap(Map hashMap) {*
    *// hashMap = (Map)new HashMap();*
    this.hashMap = hashMap;
    *public Map getHashMap() {*
    return hashMap;
    public String searchCompanyButton_action() {
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding =
    bindings.getOperationBinding("Execute");
    Object result = operationBinding.execute();
    if (!operationBinding.getErrors().isEmpty()) {
    return null;
    return null;
    *public void addCompanyActionListener(ActionEvent actionEvent){*
    AdfFacesContext.getCurrentInstance().returnFromDialog(null, hashMap);
    public void addCompanyReturnListener(ReturnEvent returnEvent){
    //how to get hashmap from here??
    public String addCompanyButton_action() {
    return "dialog:globalLovCompanies";
    }

  • How do I return a value from a column based on info from neighboring columns?

    I have a table of data that looks similar to this:
    Weight
    Name
    School
    Division
    106
    Name1
    School1
    1
    106
    Name2
    School2
    2
    106
    Name3
    School3
    3
    106
    Name4
    School4
    4
    113
    Name5
    School5
    1
    113
    Name6
    School6
    2
    113
    Name7
    School1
    3
    113
    Name8
    School3
    4
    It's a very large table, so there will be multiple matches for Schools, and occasionally a few matches for Names, but there will always be only one match for a given Weight and Division.
    In a separate table, how can I get the name of the person associated with the unique weight and division?
    In my head, the formula goes" "Look in the Weight column to find 106, then look in the Division column to find 4, then return the value from the Name column." But I can't figure out the formula that will do that.
    Any thoughts?

    Hi momogabi,
    This can be easily done with an index column.
    The formula I used in your original table for the index column is:
    =A2&"-"&D2. This was filled down. The column can be hidden.
    You can see the formula in the search table. If I wanted to eliminate the index column in that table the formula would look something like:
    =INDEX('Table 1-1'::B,MATCH(A2&"-"&B2,'Table 1-1'::E,0),1)
    Hope this helps.
    quinn

  • How to return a value from sql plus activity

    Hi,
    I want to return a value from sqlplus activity to a processflow variable.
    SQL PLUS activity has a property :"RESULT_CODE", whenever i run the process flow this value is always reurned as 0.
    in sqlplus activity i have written some pl/sql block....
    for example
    begin
    end;
    exit
    i want to do something like
    begin
    if v=100 then
    return 1
    else
    return 0;
    end if;
    end;
    exit
    can some please tell me how can i return value from this pl/sql block to proessflow.
    Regards,
    RD_RBS

    table ==> function
    input param from table to function. ==> input mapping paramter to store the output from the mapping.
    Will this now work.

  • Radio Buttons - returning individual values from an exclusion group possible?

    Using LC Designer 7.1
    Does anyone know if it is possible to return individual values from an exclusion group of radio buttons?  My xml data file gives one value for the entire group, e.g.,
    2
    ...where the second radio button was selected.  But I'd prefer an output something like this...
      0
      1
      0
    etc...
    Is something in this format possible?

    You might be better off to use checkboxes and script them to act like radio buttons (as an exclusion group). That way they'd each have an on/off value.
    Regards,
    Dave

  • Returning multiple values from a function

    Hello everyone,
    I am pretty new to actionscript and flex and one thing i am not entirly sure it is done is how to get the value in actionscript when returning multple values.
    for example i have the following function:
    public function sayhello():string
         var hello:String="hello World";
         return hello
    var myvalue:String=sayhello();
    trace(myvalue);
    How do go about getting the values of two returns:
    public function sayhello():string
         var strhello:String="hello";
          var strWorld:String="World";
         return strhello,strWorld;
    var myvalue1:String=?????
    var myvalue2:String=???

    To solve this problem you must use a object for storing complex return value.
    You can do it using inline anonymous object:
    public function sayhello():Object
         return {strHello: "hello";strWorld: "World"}
    and accesing result as:
    var obj:Object = sayhello();
    var strHello:String = obj.strHello;
    You may also create a custom class
    class HelloWorldResult{
         public var strHello:String;
         public var strWorld:String;
    and return a new instance of this class from your method:
    public function sayhello():HelloWorldResult
         var hwr:HelloWorldResult = new HelloWorldResult();
         hwr.strHello = "Hello";
         hwr.strWorld = "World";
         return hwr;

  • Return two values for one site in single query

    Oracle 10g on Solaris 10
    data:
    value integer
    date timestamp
    This query works as is:
    WITH vals AS
         (SELECT start_date_time,
              value
         FROM     r_base a,
              hdb_site_datatype b,
              hdb_site c,
              hdb_datatype d
         WHERE     a.site_datatype_id = b.site_datatype_id
         AND     a.interval = 'day'
         AND     b.site_id = c.site_id
         AND     c.site_common_name = 'CABALLO'
         AND     b.datatype_id = d.datatype_id
         AND     d.datatype_common_name = 'pool elevation'
         AND     a.start_date_time > a.start_date_time - 367)
         SELECT x.start_date_time,
              x.VALUE,
              y.start_date_time,
              y.VALUE AS valuem1w,
              z.start_date_time,
              z.VALUE AS valuem1dm1y
         FROM     vals x,
              vals y,
              vals z
         WHERE     y.start_date_time(+) = x.start_date_time - 7
         AND     z.start_date_time(+) = ADD_MONTHS (x.start_date_time-1,-12)
         AND     x.start_date_time = TO_DATE('07-JAN-2008','DD-MON-YYYY');
    and this query works:
    WITH vals AS
         (SELECT start_date_time,
              value
         FROM     r_base a,
              hdb_site_datatype b,
              hdb_site c,
              hdb_datatype d
         WHERE     a.site_datatype_id = b.site_datatype_id
         AND     a.interval = 'day'
         AND     b.site_id = c.site_id
         AND     c.site_common_name = 'CABALLO'
         AND     b.datatype_id = d.datatype_id
         AND     d.datatype_common_name = 'storage'
         AND     a.start_date_time > a.start_date_time - 367)
         SELECT x.start_date_time,
              x.VALUE,
              y.start_date_time,
              y.VALUE AS valuem1w,
              z.start_date_time,
              z.VALUE AS valuem1dm1y
         FROM     vals x,
              vals y,
              vals z
         WHERE     y.start_date_time(+) = x.start_date_time - 7
         AND     z.start_date_time(+) = ADD_MONTHS (x.start_date_time-1,-12)
         AND     x.start_date_time = TO_DATE('07-JAN-2008','DD-MON-YYYY');
    I need it to return storage and pool elevation in a single query instead of two queries.
    The results should be:
    current day, elevation_value; current day minus 1 week, elevation_value; current day minus 1 day minus 1 year, elevation_value; current day, storage_value; current day minus 1 week, storage_value; current day minus 1 day minus 1 year, storage_value
    Thanks
    Very, very much appreciate if you can show me how to do this..

    something like this, perhaps? (untested, as I don't have your data):
    WITH date_param as (select TO_DATE('07-JAN-2008','DD-MON-YYYY') p_date from dual),
    SELECT max(nvl(case when d.datatype_common_name = 'pool elevation'
                             and a.start_date_time = p_date then value
                   end)) elevation_curr_day_val,
           max(nvl(case when d.datatype_common_name = 'pool elevation'
                             and a.start_date_time = p_date-7 then value
                   end)) elevation_last_week_val,
           max(nvl(case when d.datatype_common_name = 'pool elevation'
                             and a.start_date_time = add_months(p_date-1, -12) then value
                   end)) elevation_last_year_val,
           max(nvl(case when d.datatype_common_name = 'storage'
                             and a.start_date_time = p_date then value
                   end)) storage_curr_day_val,
           max(nvl(case when d.datatype_common_name = 'storage'
                             and a.start_date_time = p_date-7 then value
                   end)) storage_last_week_val,
           max(nvl(case when d.datatype_common_name = 'storage'
                             and a.start_date_time = add_months(p_date-1, -12) then value
                   end)) storage_last_year_val
    FROM r_base a,
          hdb_site_datatype b,
          hdb_site c,
          hdb_datatype d
    WHERE a.site_datatype_id = b.site_datatype_id
    AND a.interval = 'day'
    AND b.site_id = c.site_id
    AND c.site_common_name = 'CABALLO'
    AND b.datatype_id = d.datatype_id
    AND d.datatype_common_name in ('pool elevation', 'storage')
    AND a.start_date_time in (p_date, p_date-7, add_months(p_date-1, -12));

  • Funct return two values

    hi,
    can i make a function return more than one value ?
    thanks.
    n/

    Nicholas said he wanted to use this in Forms 6i. Well, 9i Forms does not support stored procedures that return object values, so I doubt very much that6i does.
    I suggest using a procedure with two OUT parameters:
    PROCEDURE get_default_qty (
    p_supp_id IN edtrad.orcrsupp.supp_id%TYPE
    , p_item_no IN edtrad.orcrstit.stit_item_id%TYPE
    , p_ord_id IN edtrad.orcrodet.odet_order_id%TYPE
    , p_qty OUT NUMBER
    , p_val2 OUT VARCHAR2)
    IS
    qty_not_found EXCEPTION;
    PRAGMA EXCEPTION_INIT ( qty_not_found, -20004 );
    v_qty edtrad.orcrdlvd.dlvd_qty_delivrd%TYPE;
    v_val2 VARCHAR2(9);
    CURSOR qty
    IS
    SELECT vd.dlvd_qty_delivrd, "value_two"
    FROM edtrad.orcrdlvd vd,
    edtrad.orcrodet dt
    WHERE vd.dlvd_supp_id = p_supp_id
    AND vd.dlvd_order_id = p_ord_id
    AND dt.odet_item_id = p_item_no
    AND vd.dlvd_order_id = dt.odet_order_id
    AND vd.dlvd_ord_line_no = dt.odet_line_no ;
    BEGIN
    OPEN qty;
    FETCH qty INTO v_qty, v_val2;
    IF ( qty%NOTFOUND ) THEN
    CLOSE qty;
    RAISE qty_not_found;
    END IF;
    CLOSE qty;
    p _qty := v_qty ;
    p _val2 := v_val2;
    END get_default_qty ;
    Notes
    (1) You must fetch a cursor into a matching set of variables (or define a %ROWTYPE).
    (2) set_default_qty is a bad name for this method. set implies value changing. This method doesn't alter anything, it simply retrieves data. Consequently, it should be called get_default_qty.
    Cheers, APC

Maybe you are looking for

  • How to delete the records in BI for deleted reocrds in R/3

    Hi , We have a scenarion described below... We have a table in R/3 and updates happen to the table every week with a ZPROGRAM which deletes some of the records and recreates with some logic. Assuming : Initially, We did the load to BI and we got 200

  • 5th generation iPod nano is not being recognized

    I have 5th generation iPod. My computer (desktop) suddenly decided not to recognize my iPod as of yesterday.To experiment, I connected my iPod to my brother's computer (laptop) and it worked fine. Suspicious that it was my computer that went haywire,

  • IDVD 7.1.2 in OSX 10.8.5 Cannot get to finish burning DVD

    I tried two different slideshow templates in iDVD thinking that I had chosen a newer template causing my problem. I know I burned a DVD slideshow successfully last year on my computer and with my current operating system and current iDVD version. But

  • Parameters will it work like Select-Option is there any chance

    Hi Every One I am using Parameters to do selection .but in one case i need to get  some data for the whole month .i have the values in 2 different variables .(If we use select-option then we can use sign,option,low,high .).but how to do here . Any id

  • I can't sign in to my account on itunes

    every time I try to sign in to my account, I get the error "we couldn't complete your itunes store request.The itunes store is temperoraily unavailable. please try again later.".  I tried to sign in from different PC but I couldn't sign in. I can sig