Assinging default values when nothing input to varibale by user.

Hello I need to right a script that will ask for 2 date ranges to be specified by the user, this script should default to the earliest and most recent date in a table if the user dosent enter anything for each value. My script will be something like this
SELECT *
FROM table1
WHERE order_date BETWEEN &var1 AND &var2
I tried using define to give the variables an initial value but instead the script uses that value and dosent ask for input. Is it possible to use varibales this way and if so then how can I do it.
Thanks
Mike

Consider this,
SQL> create or replace function maxdate return date is
2 lv_dt date;
3 begin
4 select max(hiredate)
5 into lv_dt
6 from emp;
7 return lv_dt;
8 end;
9 /
Function created.
SQL> ed
Wrote file afiedt.buf
1 create or replace function mindate return date is
2 lv_dt date;
3 begin
4 select min(hiredate)
5 into lv_dt
6 from emp;
7 return lv_dt;
8* end;
SQL> /
Function created.
SQL> select mindate, maxdate from dual;
MINDATE MAXDATE
17-DEC-80 23-MAY-87
SQL> select * from emp
2 where hiredate between nvl('&H1', mindate) and NVL('&H2', maxdate);
Enter value for h1:
Enter value for h2:
old 2: where hiredate between nvl('&H1', mindate) and NVL('&H2', maxdate)
new 2: where hiredate between nvl('', mindate) and NVL('', maxdate)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.

Similar Messages

  • How to make default value in form input field disappear on user click

    I have an HTML input tag with a default value.
    How can I have that value disappear when user begins to type?
    Form is here:
    http://www.kardsbykaren.us/10pack.php
    Happy Holiday and thanks.

    Have a look here http://www.matiasmancini.com.ar/ajax-jquery-validation-html5-form.html
    Gramps

  • How to set the current month as the default value of an input control?

    Hello,
    I want to set the current month or current year as the default value of an input control. Something like try to get the month from the currentdate() formula and assign it to the input control.
    Is this possible?
    Thanks & Regards
    SU

    >
    soauniverse wrote:
    > Hello,
    >
    > I want to set the current month or current year as the default value of an input control. Something like try to get the month from the currentdate() formula and assign it to the input control.
    >
    > Is this possible?
    >
    > Thanks & Regards
    > SU
    I don't think so.  I tried to find a property or something in that Input Control but there is nothing to set it that way.

  • How to make the LV front panel controls the current value through the program is set as the default value when the next time you open?

    How to make the LV front panel controls the current value through the programis set as the default value when the next time you open?
    1110340051 

    Try this: Re: How to make a VI remember the latest control value?
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • I want to set a variable with default value and can be changed by the user

    hi,
    i want to set a variable with default value and can be changed by the user, so i new a variable with setting : customer exit, single value, optional, ready for input.
    in my customer exit code, i set a default value, eg. 20070530
    when the variable screen popup, it display the default value 20070530, i changed it to 20070529, but it doesn't work , it still display the data in 20070530, how can i solve this problem? 
    your help is appreciated.

    Liu,
       As mentioned by Anil, you need to restrict your customerr Exit code to I_STEP = 1.
    or.
       <u>Open your Variable in change mode, in the Last Page os the Variable Maintenance you can provide default value. Note: you are doing same thing in Customer Exit. In your case no need of Customer Exit.</u>
    Nagesh Ganisetti.
    Assign points if it helps.

  • Missing column value when logged on to windows with user id other then admi

    I am using crystal report 10 with oracle 10g database. Application is is developed on vissual studio.net 2005 (vb.net). Reports are launched from vb.net application.
    My report runs fine when I logon to windows as administrator and launch vb.net application. When I logeed on to windows with userid other then administrator my application works fine except one of the column value is missing a value in the report.  When I launch my vb.net application my oracle userid is same. Only difference is windows userid.  My application has no referance to windows userid. Why crystal report viewer is missing one column value when loged on to windows as user(xxxx)?

    CR 10.2 bundles with .NET 2005. If you do not see the CR assemblies of version 10.2.3600 in GAC, try to do a custom install of .net 2005, choosing just Crystal Reports. Note that Crystal Reports does not bundle with all versions of .NET (for example it does not ship with .NET Express - I believe...). Alternatively, you can upgrade to CR 2008 which is the latest sipping version of Crystal Reports. You can obtain a copy by calling sales at 866-681-3435, or go to this link:
    www.businessobjects.com/product/catalog/crystalreports
    An eval copy of CR 2008 can be downloaded from here:
    http://www.businessobjects.com/forms/default.asp?id=701600000009BXP
    Ludek

  • Report Builder 2.0 loses parameter Null default value when deployed

    When a parameter is set to a default value of (Null) and the report is saved to the sever, the default is lost when the report is re-opened in RB2.  This problem doesn't seem to occur in BIDS.  I've tried to use an expression to set the value to System.DBNull but this can no longer be done.
    Any ideas for a work-around?
    Is there a bug report open for this?  I couldn't find an open bug on the Connections site and there's an issue on that site right now when submitting feedback.Paul Turley [Hitachi Consulting]
    SQLServerBIBlog.com

    Hi All,
    I just had an almost identical issue using report builder 3.0 so I don't believe it is fixed. I had 4 parameters set to default to (Null) and I added a new one with identical settings but it would continually come up blank and not check the null box automatically
    when going into my sub report.
    To make matters worse I experimented changing one of the old parameters and it then started exhibiting the same behaviour. Using Luke's post above solved the issue (though it was Manage in my version not Administrate).
    Using System.DBNull.Value resulted in it being treated as a literal string "System.DBNull.Value" and putting that in the filter for me.
    Hope it helps.

  • How to assign a default value when there is no prompted value

    Dear all,
    I create a filter and it's value is relate to a prompt.If the prompt is not fill I found that all record is selected.
    How did I assign a default value so that when I didn't fill some value in to the prompt and still can get the result by
    the default value I set?
    Thanks a lot!

    Are you using dates for between or some character column?
    Post your example.
    Instead of between use to is equal prompts, so u will have then 2 fields one for date from a nd one for date to. Everything is the same as I wrote just repeat steps...
    You must put 2 separate fields if you are using date between and you want to have default variable for both.
    Column formula for the first calendar date prompt:
    case when 1=2 then TIMES.TIME_ID else cast ('1.1.1900' as date) end
    and for the second:
    case when 1=2 then TIMES.TIME_ID else cast ('1.1.2900' as date) end
    Now you set up default repository variable for both prompts.
    Presentation variable you put in the set presentation variable on each prompt:
    p_date_from
    p_date_to
    And in Answers filter will be like this:
    *TIMES.TIME_ID between @{p_date_from}{VALUEOF("rv_test_date_to_char")} and @{p_date_to}{VALUEOF("rv_test_date_to_char")}*
    or you can put a different default variables
    *TIMES.TIME_ID between @{p_date_from}{VALUEOF("rv_test_date_to_char_from")} and @{p_date_to}{VALUEOF("rv_test_date_to_char_to")}*
    I posted similar in my blog:
    Date between in filter and title when using presentation variable from calendar dashboard prompt or drop-down list in OBIEE
    http://108obiee.blogspot.com/2009/03/date-between-in-filter-and-title-when.html
    Regards,
    Goran O
    http://108obiee.blogspot.com
    Edited by: Goran O on 2009.04.23 03:37

  • How to setup a default value when defining (prompting) for a value?

    When I prompt the user in a SQL statement then I can declare a default value like in:
    SELECT *
    FROM all_users
    WHERE username = nvl('&myvariable','SYSTEM');
    But when I define a variable this does not work:
    define tablename=nvl('&tablename','test123')
    How can I setup a default value here?
    Peter

    Is there a way to define a default value DIRECTLY in SQLplus DEFINE command (and not later when the value is used in SQL statement)?no, there is not for DEFINE but you can use ACCEPT:
    SQL> accept tablename prompt 'Enter value for table Name:' default EMP
    Enter value for table Name:
    SQL> select column_name
      2  from cols
      3  where table_name='&tablename';
    OrderNumber=1234
    COLUMN_NAME
    EMPNO
    ENAME
    JOB
    MGR
    HIREDATE
    SAL
    COMM
    DEPTNO
    8 rows selected.Max
    [My Italian Oracle blog| http://oracleitalia.wordpress.com/2010/02/07/aggiornare-una-tabella-con-listruzione-merge/]

  • Default Value in Numeric Input Field in Visual Composer Application

    Hi All,
    I have developed a visual composer application which has a numeric input field for Hours.
    It is mapped to a backend module.
    We are using portal 7.31
    The problem is that the deafult value of this input field is "0", but the rquirement is to display as "0.0"
    The functionality has been tested with input values in decimals and works fine. The problem is when the screen first populates, that field should show "0.0" .
    Please advise.
    Thanks

    Hi Soumya Chanda,
    I don't know of an agreeable way around it. You could have a textual input, but then it doesn't have the numeric control behavior, plus you need to handle incorrect typing (alphanumeric notes).
    Sorry!

  • Why does the string indicator revert to default value when it's not being used?

    Can anyone explain to me why one of the two string indicators in the attached VI reverts to it's default value (empty) when the case structure is false?
    Attachments:
    LabView bug.vi ‏8 KB

    String 1 is wired to the connector pane...that's why you're seeing this behavior.  Disconnect String 1 from the connector pane and it will behave just like String 2.  Likewise, connect String 2 to the connector pane and you'll see it get blanked out too.  I'm not really sure why we empty the value when it's wired to the connector pane, but the behavior goes back to LabVIEW 8.0, maybe earlier.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • WF_NOTIFICATIONS Default values when created

    Hi guys,
    I am really new in EBS API stuff. I would like to know if I can set a value in one of the text attributes of WF_NOTIFICATIONS so whenever a new notification is created one of this field (see below) could be fetched with a default value.
    (e.g
    TEXT_ATTRIBUTE1 VARCHAR2(4000)
    TEXT_ATTRIBUTE2 VARCHAR2(4000)
    TEXT_ATTRIBUTE3 VARCHAR2(4000)
    TEXT_ATTRIBUTE4 VARCHAR2(4000)
    TEXT_ATTRIBUTE5 VARCHAR2(4000)
    TEXT_ATTRIBUTE6 VARCHAR2(4000)
    TEXT_ATTRIBUTE7 VARCHAR2(4000)
    TEXT_ATTRIBUTE8 VARCHAR2(4000)
    TEXT_ATTRIBUTE9 VARCHAR2(4000)
    TEXT_ATTRIBUTE10 VARCHAR2(4000)
    Regards,

    Nothing here???

  • Setting control to default value when it is a strict type def

    If my subVI has a control that happens to be a strict type defined cluster and I have saved the values in the control as the default values, how can I change them back to the default values of the type def (which are empty).  Because it is a strict type definition, i cannot click on the elements inside the cluster and modify them (e.g. click on an array inside the cluster and do an empty array operation.)
    In the attached screenshot, the control "BLE Meters To Test" is just an array of clusters and I was able to empty the array.  The control "Capture Data" is a strict type def.  I would like to clear the contents of this control without having to delete the control and add it back with a new instance of the same strict type def.
    Solved!
    Go to Solution.
    Attachments:
    screenshot.PNG ‏33 KB

    are you talking about edit mode or run mode?
    You could temporarily add a second instance of the typedef (all empty), then change it to a constant. Whenver you need to reset at run time, write the new digram constant to a local variable of the control.
    glstill wrote:
    Because it is a strict type definition, i cannot click on the elements inside the cluster and modify them (e.g. click on an array inside the cluster and do an empty array operation.)
    Make sure to click on the array container, not on the array elements.
    LabVIEW Champion . Do more with less code and in less time .

  • Default values in the input fields of Adobe forms

    Hi,
    The default value settings in the value tab of the object pallette(Adobe Designer) is not getting reflected at the form (Portal level).. PLs help. what could be the reason for this.
    Can it be done through coding? if yes, pl[ease help with regard to it.
    I appreciate your valuable comments.

    Hi,
    If you are using <i>ISR based Adobe Interactive Forms</i>, you can set the default values using <b>INT_SERVICE_REQUEST_INIT</b> method if<b> QISR</b> BADI.
    Regards,
    <i><b>Raja Sekhar</b></i>

  • SAP remove the default values when modify the default warehouse at SO lines

    Hi All,
    Whenever I change the default warehouse field at SO lines, all the default dimension values will be removed.
    Is this normal for SAP operation?
    Any setting to prevent it to remove all default values?
    Thank you very much.
    Best Regards,
    Vivian

    Hi Vivian,
    Check the link
    I want to remove default warehouse condition
    Regards
    Jambulingam.P

Maybe you are looking for

  • UPPER() in external table definition

    Hi, Is it possible to apply the UPPER() function to character columns within an external table definition using the ORACLE_LOADER driver? I've tried myself and have looked through the documentation, and it seems like this is not possible ... just wan

  • E1200 bridge & have WiFi DHCP?

    At my work we have Comcast Business Class, and our LAN uses the Comcast's SMC static 10'net addressing.  Our two POS computers are connected to wall ports that connect to the SMC router (unsure its model number, it's screwed to the wall).  There is o

  • N80 MP3 problem

    My wife's just got her new N80 and it seems to have some issues playing MP3s. There's quite a few i've just transferred straight from my SE K750 to the N80 that upon trying to play them the phone just says "Unable to play media clip". They're just st

  • Read Unicode filename

    Hi, I am new in Java and facing problem with reading unicode filename. I tried to read a xml file that stored in desktop with chinese character filename using java but it return exception when come to this line of code - xmldoc = builder.build(inputF

  • Z10 got wet and now apps will not open

    Yesterday my phone got wet.  After removing the sim card, sd card, battery and drying overnight it will boot up but now none of the apps will open. When I press an icon (for an app), the screen looks like it's about to shift to the active frames scre