SQL Statment Help

hiya
i need help about SQL statment i want get all employee Data if i know the emp_no get specify recored if emp_no = null get all Data
select * from employe where emp_no=123 if emp_no=null get all records
thx

Hi,
Welcome to the forum!
Ttushar's solution is what you requested.
If empno can not be NULL, then you can also modify it like this:
SELECT  *
FROM     employee
WHERE     emp_no = NVL (:v_emp_no, emp_no);

Similar Messages

  • Need help in SQl statment

    this SQL statment work in oracle database :
    SELECT TO_DATE('20080627','YYYYMMDD') - TO_DATE('20080526','YYYYMMDD') FROM dual
    But didn'twork on Timesten Database and this error is appear
    2789: An interval data type must be specified for a datetime arithmetic result
    The command failed.

    SELECT extract (day from TO_DATE('20080627','YYYYMMDD') - TO_DATE('20080626','YYYYMMDD')) FROM dual;
    See
    http://download.oracle.com/otn_hosted_doc/timesten/703/TimesTenDocumentation/wwhelp/wwhimpl/js/html/wwhelp.htm?&accessible=true
    for details.

  • Help in writing SQl Statment

    Hi all,
    I have a table which contain project details those are the coulmns:
    Project_number (PK)
    Submit Date
    Project_title
    Project_milestones
    I want to retrieve how many number of project in each mounth per year
    Output Example:
    Date Number of projects
    FEB 2008 *6*
    March 2008 *5*
    FEB 2009 *4*
    March 2009 *7*
    And so on, I tryed to write an sql statment to retrieve the desired results but I couldn't.
    If any one has any idea in retrieving such result please assist me how to write this sql statment.

    Hi,
    If submit_date is a DATE, then TRUNC (submit_date, 'MM') is the beginning of the month that countains it.
    So you can say:
    SELECT    TRUNC (submit_date, 'MM')   AS month
    ,         COUNT (*)                   AS cnt
    FROM      project_table
    GROUP BY  TRUNC (submit_date, 'MM');Of course, you can add TO_CHAR to the first line to format the date however you like.

  • How to access currently executing SQL statment?

    Hello -
    I have a C language external procedure that is called from an INSERT / UPDATE / DELETE trigger.
    Is there a way (using OCI, or elsewhere) to get a string containing the SQL statment that fired the trigger?
    Thanks a bunch for your help!
    -js

    http://databasejournal.com/features/oracle/article.php/3373701
    The second page has more details (there is also a part II to this article if you are interested).

  • Problem with DBMS_OUTPUT and SQL statment with a function

    I am using SQL Developer version 3.0.04 and I have a function that has a dbms_output statment in it. I am running the following SQL to select the output of that statment.
    select A.A_FUCTION('TEST') from dual;
    The output works fine but the dbms_output line does not show in the dbms_output window. I turned on the output window etc. and i can get the select to print out the output if i wrap it in a declare begin end wrapper... and then change the query to insert the return value into variable.
    just wondering if there is way to get the dbms_output to flush out with just an SQL statment instead of in a begin end wrapper etc.

    just wondering if there is way to get the dbms_output to flush out with just an SQL statment instead of in a begin end wrapper etc.works fine in sql*plus, so I guess it must be a preference or sth. in sql*developer:
    SQL> set serverout on
    SQL> create or replace function f1 (r int)
      2    return int
      3  as
      4  begin
      5    dbms_output.put_line ('Hello World ' || r);
      6    return r;
      7  end f1;
      8  /
    Function created.
    SQL>
    SQL> select f1 (rownum) f1 from dual connect by level <= 3
      2  /
            F1
             1
             2
             3
    3 rows selected.
    Hello World 1
    Hello World 2
    Hello World 3
    SQL>

  • SQL*Plus Help

    Hi! Does anyone know where i can download SQL*Plus Help? I need to get info on select syntax, sql built-in functions, etc..
    Thanks!

    hi
    you can proceed like this :
    go to the OTN
    the click on products.
    null

  • How to find top 10  SQL statments which are consuming more cpu time.

    hi all,
    Is there any command or script to monitor the top 10 sql statments which are consuming more cpu time.
    I know by using AWR REPORT we can find it, i want the command or script to find the top cpu utilization sql statments.
    Regards
    Subhash.

    Subhash,
    A quick and dirty Google search could have get you started with the following:
    Thread: how to get top CPU consuming sql oracle 10g
    Re: how to get top CPU consuming sql oracle 10g
    Oracle SQL top sessions
    http://www.dba-oracle.com/oracle10g_tuning/t_sql_top_sessions.htm
    "How to Find top 10 expensive sql's", version 9.2.0
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:73325450402303
    HTH,
    Thierry

  • Newbee Question to SQL Statment ..

    Hello,
    what does the statment PRODWH refer to in the statment below ....?
    what s the function of {?PRODWH: F_INVOICES.PROD_ID}. Is it an Input Parameter for the user ?
    ist the statment "external Join" replaceble trough Right/left Join ..?
    SQL Statment-------------------
    PRODWH
    SELECT
    "D_PROD_DESC"."PRODUCT_DESC_SHORT",
    "D_PROD"."SKU", "D_PRODUCT"."BU_DEPARTMENT",
    "D_PROD"."PROD_ID"
    FROM
    "D_PROD_DESC" "D_PROD_DESC" INNER JOIN
    "D_PROD" "D_PROD" ON
    "D_PROD_DESC"."PROD_ID"="D_PROD"."PROD_ID"
    EXTERNAL JOIN D_PROD.BU_DEPARTMENT={?PRODWH: Command.BU_DEPARTMENT} AND
    D_PROD.PROD_ID={?PRODWH: F_INVOICES.PROD_ID} AND
    D_PROD.SKU={?PRODWH: D_OLD_CUST.BU_SKU}
    -----END----------------

    The Database is Oracle but the SQL statment is generated by Crystal Reports XI

  • How to install SQL*Plus help facilities and demos.

    Hi, everyone
    It appears error message say "failure to login" during SQL*Plus
    part of the Oracle8 full installation. I knew that system want
    to install SQL*Plus help and demos through logining one of
    dba account(maybe system user account). However, due to
    password's reason, can not log in SQL*Plus, so installer can't
    execute named pupbld.sql script, result in SQL*Plus help and
    demos can not be installed.
    Now, I am intend to install these stuff lonely.
    Could anyone help me? thank a lot.
    William
    null

    Hi,
    The pupbld.sql isn't the correct script to create the help
    facility, it just creates product and user profile tables.
    The help script is at $ORACLE_HOME/sqlplus/admin/help (run as
    system)
    cd $ORACLE_HOME/sqlplus/admin/help
    sqlplus system/<password> @helptbl
    sqlldr system/<password> control=plushelp.ctl
    sqlldr system/<password> control=plshelp.ctl
    sqlldr system/<password> control=sqlhelp.ctl
    sqlplus system/<password> @helpindx
    I think it is necessary to run the pupbld.sql script, without
    this script everyone who logins in oracle with sqlplus will see
    an error message, but... Run the script again:
    $ORACLE_HOME/sqlplus/admin/pupbld.sql
    Best regards,
    Ari
    William (guest) wrote:
    : Hi, everyone
    : It appears error message say "failure to login" during SQL*Plus
    : part of the Oracle8 full installation. I knew that system want
    : to install SQL*Plus help and demos through logining one of
    : dba account(maybe system user account). However, due to
    : password's reason, can not log in SQL*Plus, so installer can't
    : execute named pupbld.sql script, result in SQL*Plus help and
    : demos can not be installed.
    : Now, I am intend to install these stuff lonely.
    : Could anyone help me? thank a lot.
    : William
    null

  • Will Oracle pl/sql certification help me get  IT job

    Hello guys,
    I have completed my B.tech in Computer Science, I am confused a bit , Can i get a job after getting certified in Oracle Associate Pl/sql developer

    1005323 wrote:
    Hello guys,
    I have completed my B.tech in Computer Science, I am confused a bit , Can i get a job after getting certified in Oracle Associate Pl/sql developerYou may get a job after achieving Pl/sql developer OCA
    You may get a job after without achieving Pl/sql developer OCA
    You may fail to get a job after achieving Pl/sql developer OCA
    You may fail to get a job after without achieving Pl/sql developer OCA
    There are several factors involved in getting a job. And there are several ways a job may be obtained. But usually there are there stages:
    - Stage Zero: A company but has a job to offer.
    - And you need to be aware of it. - A friend may tell you, or an agency may tell you. And it must suit you for location and remuneration etc.
    - Stage one: An interview is obtained with the company.
    - Stage two: The job is offered to you rather than anyone else and you find it acceptable.
    So ... to your question:
    "Can i get a job after getting certified in Oracle Associate Pl/sql developer?"
    Well .... there is only three possible answers ... yes, no, and maybe; and maybe is probably the only correct answer, and most people will have worked this out, which means the question may have not been the best question to have asked.
    (( That said I now read the title of the thread and it says: Re: Will Oracle pl/sql certification help me get IT job)
    I have been known on occasion to have been given a question by a boss.
    And I have answered him:
    "You have given me the wrong question
    The question you should have answer me is this.
    And the answer I will give you is this."
    And the boss goes away happy
    So you you a better question would have been:
    How much will an OCA PL/SQL certification increase my chances of getting a job?
    Mind you even that question won't help you get a much better answer.
    For a proportion of jobs where PL/SQL is relevant that will help (for those where it is not it might be occasionally be a problem), for people with identical CV's it sometimes might help get to interview stage. But there are other factors as well. For instance if I was thinking of giving you a job on the basis of your post I might for example:
    - Not be impressed with an "Hello Guys" greeting ( though this is a forum so that isn't relevant here).
    - Not be impressed with you being confused.
    - etc.
    You probably need to get a good appreciation of the job market in your locality; and the numbers of applicants for each job. Which jobs you can apply for, what is your skillset and knowing youself as well.
    Sometimes an ITIL certification may be a better differentiator for some positions in business. But it will depend on the job you can think you can get.

  • Embeded SQL Statment VS Store procedure

    On J2ee tecknology, what is the better method of usind data services.
    raping all sql statment in the store procedure or embeded all sql statment in EJB.
    thanks
    null

    Hi,
    This issue looks similar to the the issue described in:
    Re: Exception in reader for ODP.NET 11.1.0.6.2 same work fine in older version
    Note that Bug 9792727 was filed to track the issue described in the above link.
    Regards,
    -Naveen

  • (SQL*PLUS HELP) RUNNING PUPBLD OR HELPINS ASKS FOR SYSTEM_PASS

    제품 : ORACLE SERVER
    작성날짜 : 2002-04-22
    (SQL*PLUS HELP) RUNNING PUPBLD OR HELPINS ASKS FOR SYSTEM_PASS
    ==============================================================
    PURPOSE
    이 내용은 SQL*Plus 상에서 SQL*Plus command의 help를 보기 위한 방법이다.
    Problem Description
    SQL*Plus command의 help를 보기 위해서 helpins를 수행하면
    SYSTEM_PASS is not set이라는 에러 메시지가 발생하는 경우가 있다.
    이 자료는 pupbld 또는 helpins를 수행하기 전에 SYSTEM_PASS 환경변수를
    셋팅하는 방법에 대한 자료이다.
    아래와 같은 에러가 발생하는 경우 조치 방법에 대해 알아본다.
    SYSTEM_PASS not set.
    Set and export SYSTEM_PASS, then restart help (for helpins or
    profile for pupbld) installation.
    Workaround
    none
    Solution Description
    이 스크립트는 system user로 database에 connect되어 수행되어야 한다.
    helpins를 수행하기 위해서는 SYSTEM_PASS 환경변수가 셋팅되어 있어야 한다.
    NOTE
    For security reasons, do not set this variable in your shell
    startup scripts. (i.e. .login or .profile.).
    Set this environment variable at the prompt.
    1. Prompt에서 환경변수를 셋팅하기
    For C shell:
    % setenv SYSTEM_PASS system/<password>
    For Korn or Bourne shells:
    $ SYSTEM_PASS=system/<password> ;export SYSTEM_PASS
    2. Now run "$ORACLE_HOME/bin/pupbld" or "$ORACLE_HOME/bin/helpins".
    % cd $ORACLE_HOME/bin
    % pupbld
    or
    % helpins
    주의사항
    $ORACLE_HOME/bin/pupbld 스크립트와 $ORACLE_HOME/bin/helpins 스크
    립트를 수행하기 위해서는 반드시 SYSTEM_PASS 환경변수를 필요로 한다.
    Reference Document
    <Note:1037075.6>

    check it please whether it is a database version or just you are installing a client. Install Enterprize database on 2k system. I you are running a client software then you are to deinstall it.

  • Download Oracle SQL*Plus help related like word help

    Hello all
    I just wanna ask if where i can download Oracle SQL*Plus help related like word help.?
    ty

    <p>You can access SQL*Plus help from the command line in a SQL*Plus session by typing 'help index'. If you want more information than that, take a look at the SQL*Plus Quick Reference located <b>here</b> or the SQL*Plus User's Guide and Reference located <b>here</b>. These docs are all for Oracle 10g. Other version documentation can be found <b>here</b>.</p>
    Tom

  • SQL Server2008 help needed

    Having trouble with SQLServer 2008 (not MySQL) and my database connection in Dreamweaver CS6.  My document type is set as .asp using VBScript.  I can list the table information  but cannot use the insert wizard to add new records.  I don't get any errors after creating the insert form, but no records get inserted.  I'm not a VBScript expert, but do I have to manually write some code to insert records?  How do I attach it to a button?

    Thanks for the quick reply.  I won't be back in the office for a few days, but I'll try to post it when I get back in.  It's pretty much the code generated from the Dreamweaver Insert Record wizard.  I see where the submit button is created and the value is set but the action on the form is set to MM_insert, so I don't see where the submit code is actually called.
    Date: Wed, 3 Oct 2012 12:06:14 -0600
    From: [email protected]
    To: [email protected]
    Subject: SQL Server2008 help needed
        Re: SQL Server2008 help needed
        created by bregent in Dreamweaver General - View the full discussion
    This post should be moved to the app dev forum.  Please post the code from your form and the insert script pages.
         Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4746757#4746757
         Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4746757#4746757
         To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4746757#4746757. In the Actions box on the right, click the Stop Email Notifications link.
         Start a new discussion in Dreamweaver General by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Getting a DataReader by stored procedure vs. SQL statment (Performance)

    Hallo DB-Experts,
    I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
    and I want to know if this is an known issue and how to tune it.
    Getting a DataReader through a SQL statment is faster than with a stored procedure,
    if the number of data rows are less than about 8000 datarows, although we are using an index.
    The stored procedure ist only faster about 8000 datarows.
    For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
    Over 8000 rows the stored procedure is faster!
    The time series table looks like:
    CREATE TABLE TimeSeries
    OBJECT_ID NUMBER(8) NOT NULL,
    UNIVERSAL_TIME NUMBER(10) NOT NULL,
    LOCAL_TIME DATE NOT NULL,
    MOD_TIME NUMBER(10),
    USERID NUMBER(10),
    VALUE NUMBER NOT NULL,
    FLAG NUMBER(2) DEFAULT 0 NOT NULL
    The foreinkey is object_id and another index is for universal_time and mod_time
    The stored procedure looks like:
    PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
    pType IN VARCHAR2,
    pTable IN VARCHAR2,
    pFrom IN NUMBER,
    pTo IN NUMBER,
    IO_CURSOR OUT T_CURSOR)
    IS
    SQLString VARCHAR2(1024);
    BEGIN
    IF pOBJECTID <> 0 THEN
    CASE
    WHEN UPPER(pTYPE)='A' THEN
    SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
    OPEN IO_CURSOR FOR
    SQLString USING pOBJECTID,pFROM,pTO;
    END IF;
    END;
    The SQL statment for the data reader looks like:
    SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
    FROM daten d
    WHERE object_id = 18465
    AND d.universal_time >= 3600
    AND d.universal_time < 28803600
    ORDER BY d.universal_time, mod_time DESC
    Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
    Many thanks in advance and
    Best regards
    George
    Edited by: hakomdba on 09.01.2009 06:39

    Hallo DB-Experts,
    I have encountered a performance problem regarding getting a DataReader by stored procedure versus a SQL statment
    and I want to know if this is an known issue and how to tune it.
    Getting a DataReader through a SQL statment is faster than with a stored procedure,
    if the number of data rows are less than about 8000 datarows, although we are using an index.
    The stored procedure ist only faster about 8000 datarows.
    For the first 20 rows the different is between 50 abd 20 percent and between and 20 and 2000 rows it fall down to 10 percent.
    Over 8000 rows the stored procedure is faster!
    The time series table looks like:
    CREATE TABLE TimeSeries
    OBJECT_ID NUMBER(8) NOT NULL,
    UNIVERSAL_TIME NUMBER(10) NOT NULL,
    LOCAL_TIME DATE NOT NULL,
    MOD_TIME NUMBER(10),
    USERID NUMBER(10),
    VALUE NUMBER NOT NULL,
    FLAG NUMBER(2) DEFAULT 0 NOT NULL
    The foreinkey is object_id and another index is for universal_time and mod_time
    The stored procedure looks like:
    PROCEDURE SELECTDATA_UT_MOD (pObjectID IN NUMBER,
    pType IN VARCHAR2,
    pTable IN VARCHAR2,
    pFrom IN NUMBER,
    pTo IN NUMBER,
    IO_CURSOR OUT T_CURSOR)
    IS
    SQLString VARCHAR2(1024);
    BEGIN
    IF pOBJECTID <> 0 THEN
    CASE
    WHEN UPPER(pTYPE)='A' THEN
    SQLString := 'SELECT UNIVERSAL_TIME, VALUE, FLAG, MOD_TIME FROM ' || pTABLE || ' WHERE OBJECT_ID = :t1 AND UNIVERSAL_TIME >= :t2 and UNIVERSAL_TIME < :t3 Order By UNIVERSAL_TIME, MOD_TIME DESC';
    OPEN IO_CURSOR FOR
    SQLString USING pOBJECTID,pFROM,pTO;
    END IF;
    END;
    The SQL statment for the data reader looks like:
    SELECT d.universal_time, d.VALUE, d.flag, 0 AS mod_time
    FROM daten d
    WHERE object_id = 18465
    AND d.universal_time >= 3600
    AND d.universal_time < 28803600
    ORDER BY d.universal_time, mod_time DESC
    Do you have any idea or tip why the sql statment for the first 8000 rows is faster than the stored procedure?
    Many thanks in advance and
    Best regards
    George
    Edited by: hakomdba on 09.01.2009 06:39

Maybe you are looking for

  • HP Envy 23 touchsmart windows 8.1 computer has no sound only with headset

    Computer had working sound 2 days ago.  But now it will only work with a headset.  I have checked and tested and says every thing is working fine.  I am at a loss. Thanks,

  • Auto viewer gallerys not working, please help??

    Hi please look at www.websitedesignportugal.com/townhouse2 if you look at the top right there is 2 button for external gallery and internal. these link to a auto viewer galleries. when i preview in dreamweaver it works but when i upload the site it d

  • How can I create iTunes U content?

    Especially with the newly integrated features with the new iBooks...I would LOVE to use this feature to write courses as an individual or as a representative of a group that's not "official" in the sense that Apple seems to be striving for (Universit

  • No ATV purchased movies show up in Itunes

    I have a new ATV 3G.  Everything in itunes shows up great on the ATV, but I purchasedd 2 movies on the ATV, and they do NOT show up in itunes, and my ATV doesn't show as a device??  Why can I see Itunes in ATV, and not the reverse?

  • Order creation using workflow

    Hello, I'm trying to create sales order automatically using event triggered by user status changes. I need no user participation in this process. Can i use workflow for this purpose? As i see from documentation' examples user activity is needed...Do