How can I parse a sql sentence like Oracle system do it ?

I want to parse a sql sentence like Oracle system do.
for example: here is a sql as follow
select * from scott.emp;
I want to use some functions to get 'scott.emp' as result, how can I do ?
Thanks.

PS. If you are doing it in sqlplus you can use lexical references, that is parts of the select statement can be in variables.
For example you could do something like this but pass in the value of &1:
SQL> select &1;
Enter value for 1: * from dual
old 1: select &1
new 1: select * from dual
D
X

Similar Messages

  • How can I invoke a sql loader from oracle form?

    I'm got a problem on invoking sql loader command from oracle form where the sql loader product has been installed in Window NT.
    Thanks for your help!

    U can use HOST procedure with NO_SCREEN option.
    this will go like
    Host('d:\orant\bin\SQLLDR80 USERID=username/password@connect CONTROL=contril_file.CTL LOG=log_file.LOG discard=discard_file.dis bad=bad_file.bad', NO_SCREEN);
    Hope this will Work
    Good Luck :-)
    Naren

  • How can i use one SQL statement to solve problem?

    How can i use one SQL statement to solve the question below?
    For a Table named A, there is a column named F(char type).
    Now select all the records where F like '%00' and update their F value to '%01'
    Just one SQL statement.Do not use PL/SQL block.
    How to do that?
    Thanks.

    What is the data volume for this table?
    Do you expect lots of rows to have '%00' as their value?
    Following two statements come to mind. Other experts would be able to provide better alternatives:
    If you have index on SUBSTR(f, 2):
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) || '01'
    WHERE  substr(f,
                  -2) = '00';If most of the rows have pattern '%00':
    UPDATE A
    SET    f = SUBSTR(f,
                      1,
                      length(f) - 2) ||
               DECODE(SUBSTR(f,
                             -2),
                      '00',
                      '01',
                      SUBSTR(f,
                             -2));

  • How can I connect to SQL Server CE?

    Hi!
    How can I connect to SQL Server CE ?
    Any idea?
    I found jdbc driver for SQL Server 6.5,7.0,2000.
    But no driver for SQL CE.
    Thanks for any suggestion....

    I am also searching for same answer.
    I wanna choose Access as a db. but I can't find that so I have a no choice to select SQL2000CE though.
    I am stuck in driver problem. I can't find that.
    Should I use Oracle Lite or PointBase?
    I am under a lot of stress... like you've been...
    I wish you find and post that....

  • How can I run a SQL script file...

    How can I run a SQL script file from a location on my computer without providing the whole path?
    Is there some way I can set a "Working folder" in SQL Plus??
    Thanks!
    Tom

    You can create an environment variable called "SQLPATH" which is a list of directories that SQL*Plus will search for your .SQL
    scripts.
    I would like to use another directory than the oracle/bin...
    How can I do this ??
    Hello,
    U can do this by this way:
    Save odm_script.sql file to the default Oracle
    directory i.e. Oracle-Home/bin and Run following command
    through SQL Plus.
    SQL>@Script_Name
    I hope this will resolve ur problem.
    Regards,
    Omer Saeed Khan.

  • How can I improve below SQL performance.

    Hi,
    How can I improve below SQL performance. This SQL consumes CPU and occures wait events. It is running every 10 seconds. When I look at the session information from Enterprise Manager I can see that "Histogram for Wait Event: PX Deq Credit: send blkd"
    I created some indexes. I heard that the indexes are not used when there is a NULL but when I checked the xecution plan It uses index.
    SELECT i.ID
    FROM EXPRESS.invoices i
    WHERE i.nbr IS NOT NULL
    AND i.EXTRACT_BATCH IS NULL
    AND i.SUB_TYPE='COD'
    Explain Plan from Toad
    SELECT STATEMENT CHOOSECost: 77 Bytes: 6,98 Cardinality: 349                     
         4 PX COORDINATOR                
              3 PX SEND QC (RANDOM) SYS.:TQ10000 Cost: 77 Bytes: 6,98 Cardinality: 349           
                   2 PX BLOCK ITERATOR Cost: 77 Bytes: 6,98 Cardinality: 349      
                        1 INDEX FAST FULL SCAN INDEX EXPRESS.INVC_TRANS_INDX Cost: 77 Bytes: 6,98 Cardinality: 349
    Execution Plan from Sqlplus
    | Id | Operation | Name | Rows | Bytes | Cost | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 349 | 6980 | 77 | | | |
    | 1 | PX COORDINATOR | | | | | | | |
    | 2 | PX SEND QC (RANDOM) | :TQ10000 | 349 | 6980 | 77 | Q1,00 | P->S | QC (RAND) |
    | 3 | PX BLOCK ITERATOR | | 349 | 6980 | 77 | Q1,00 | PCWC | |
    |* 4 | INDEX FAST FULL SCAN| INVC_TRANS_INDX | 349 | 6980 | 77 | Q1,00 | PCWP | |
    Predicate Information (identified by operation id):
    4 - filter("I"."NBR" IS NOT NULL AND "I"."EXTRACT_BATCH" IS NULL AND "I"."SUB_TYPE"='COD')
    Note
    - 'PLAN_TABLE' is old version
    - cpu costing is off (consider enabling it)
    Statistics
    141 recursive calls
    0 db block gets
    5568 consistent gets
    0 physical reads
    0 redo size
    319 bytes sent via SQL*Net to client
    458 bytes received via SQL*Net from client
    1 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    0 rows processed
    Instance Efficiency Percentages (Target 100%)
    Buffer Nowait %: 100.00
    Redo NoWait %: 100.00
    Buffer Hit %: 99.70
    In-memory Sort %: 100.00
    Library Hit %: 99.81
    Soft Parse %: 99.77
    Execute to Parse %: 63.56
    Latch Hit %: 90.07
    Parse CPU to Parse Elapsd %: 0.81
    % Non-Parse CPU: 98.88
    Top 5 Timed Events                         
    Event     Waits     Time(s)     Avg Wait(ms)     % Total Call Time     Wait Class
    latch: library cache     12,626     16,757     1,327     62.6     Concurrency
    CPU time          5,712          21.Mar     
    latch: session allocation     1,848,987     1,99     1     07.Nis     Other
    PX Deq Credit: send blkd     1,242,265     981     1     03.Tem     Other
    PX qref latch     1,405,819     726     1     02.Tem     Other
    The database version is 10.2.0.1 but we haven't installed the patch 10.2.0.5. yet.
    I am waiting your comments.
    Thanks in advance

    Welcome to the forum.
    I created some indexes. I heard that the indexes are not used when there is a NULL but when I checked the xecution plan It uses index. What columns are indexed?
    And what do:
    select i.sub_type
    ,      count(*)
    from   express.invoices i
    where  i.nbr is not null
    and    i.extract_batch is null
    group by i.sub_type; and
    select i.sub_type
    ,      count(*)
    from   express.invoices i
    group by i.sub_type; return?
    Also, try use the {noformat}{noformat} tag when posting examples/execution plans etc.
    See: HOW TO: Post a SQL statement tuning request - template posting for more tuning instructions.
    It'll make a big difference:
    SELECT i.ID
    FROM EXPRESS.invoices i
    WHERE i.nbr IS NOT NULL
    AND i.EXTRACT_BATCH IS NULL
    AND i.SUB_TYPE='COD'
    Explain Plan from Toad
    SELECT STATEMENT CHOOSECost: 77 Bytes: 6,98 Cardinality: 349                     
         4 PX COORDINATOR                
              3 PX SEND QC (RANDOM) SYS.:TQ10000 Cost: 77 Bytes: 6,98 Cardinality: 349           
                   2 PX BLOCK ITERATOR Cost: 77 Bytes: 6,98 Cardinality: 349      
                        1 INDEX FAST FULL SCAN INDEX EXPRESS.INVC_TRANS_INDX Cost: 77 Bytes: 6,98 Cardinality: 349
    Execution Plan from Sqlplus
    | Id | Operation | Name | Rows | Bytes | Cost | TQ |IN-OUT| PQ Distrib |
    | 0 | SELECT STATEMENT | | 349 | 6980 | 77 | | | |
    | 1 | PX COORDINATOR | | | | | | | |
    | 2 | PX SEND QC (RANDOM) | :TQ10000 | 349 | 6980 | 77 | Q1,00 | P->S | QC (RAND) |
    | 3 | PX BLOCK ITERATOR | | 349 | 6980 | 77 | Q1,00 | PCWC | |
    |* 4 | INDEX FAST FULL SCAN| INVC_TRANS_INDX | 349 | 6980 | 77 | Q1,00 | PCWP | |
    Predicate Information (identified by operation id):
    4 - filter("I"."NBR" IS NOT NULL AND "I"."EXTRACT_BATCH" IS NULL AND "I"."SUB_TYPE"='COD')
    Note
    - 'PLAN_TABLE' is old version
    - cpu costing is off (consider enabling it)
    Statistics
    141 recursive calls
    0 db block gets
    5568 consistent gets
    0 physical reads
    0 redo size
    319 bytes sent via SQL*Net to client
    458 bytes received via SQL*Net from client
    1 SQL*Net roundtrips to/from client
    1 sorts (memory)
    0 sorts (disk)
    0 rows processed
    Instance Efficiency Percentages (Target 100%)
    Buffer Nowait %: 100.00
    Redo NoWait %: 100.00
    Buffer Hit %: 99.70
    In-memory Sort %: 100.00
    Library Hit %: 99.81
    Soft Parse %: 99.77
    Execute to Parse %: 63.56
    Latch Hit %: 90.07
    Parse CPU to Parse Elapsd %: 0.81
    % Non-Parse CPU: 98.88
    Top 5 Timed Events                         
    Event     Waits     Time(s)     Avg Wait(ms)     % Total Call Time     Wait Class
    latch: library cache     12,626     16,757     1,327     62.6     Concurrency
    CPU time          5,712          21.Mar     
    latch: session allocation     1,848,987     1,99     1     07.Nis     Other
    PX Deq Credit: send blkd     1,242,265     981     1     03.Tem     Other
    PX qref latch     1,405,819     726     1     02.Tem     Other

  • How can I write a SQL statement which checks if a table exists?

    How can I write a SQL statement which tells me whether a table exists?

    execute an sql query: select * from <tablename>
    catch the exception n check whether the erroe code
    matches the one that occurs for table doesn't exist
    that's itHow is your answer any different from the one given in the first reply?
    It isn't.
    As WorkForFood says DatabaseMetaData has a bunch of methods for getting information about tables but this is more useful when you don't know the names of any of the tables.. it sounds like you do so I would concur SELECT from table is probably the quickest way to go. If it helps the Xopen error should be either S1000 or 42S01 (I think) but I would try and see if there is a specific vendor code for table not found/not exists error and check for that.

  • How can I use my Zen Xtra like a flash memory

    Hello, I want to know how can I use my MP3 player like a flash memory.
    I have one and if I conect it with other computers I can't transfer documents and with a flash memory I conect it in all the computers with Windows XP and all of they detect the flash memory and they can transfer documents.
    With my Zen Xtra I connect it and the computer detects it but I can't transfer anything because the computer doesn't have the software.
    My question is.. Do I have to install the software in all the computers that I use ? or there are other forms to conects PC and MP3 Player? ( I want to transfer documents like text, image, etc)

    But some MP3 players do that, why this one can't be connected with all the computers ?
    Message Edited by morfo on 0-22-2005 05:54 PM

  • How can I quickly view pdf files like I can do with Windows Picture and Fax viewer for jpg files?

    How can I quickly view pdf files like I can do with Windows Picture and Fax viewer for jpg files? I need to look at several thousand PDF files. It takes too long to open each one individually. The only thing I could think of is combining them into large groups and then using the Navigation index. But I like the way windows Picture and Fax Viewer does it because you can keep the files separate. Combining PDFs causes loss of individual file names. That would be a problem since I do need to have the individual file names.

    Windows Picture and Fax Viewer is a DLL and is started via a rundll32.exe call and can't be set as an application to handle images in Firefox 3 and later versions.
    Try to set Windows Picture and Fax Viewer as the default viewer in Windows, then it should be listed automatically in the Mozilla Firefox Browse dialog.
    *http://www.winhelponline.com/articles/115/1/Windows-Picture-and-Fax-Viewer-as-the-default-viewer-in-Mozilla-Firefox.html
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • How Can I Run a SQL Loader Job from Schedular

    How Can I Run a SQL Loader Job from Schedular , So that It Runs every Day.

    Depends on a couple of factors.
    If you are on a UNIX platform, you can create a shell script and schedule it with cron.
    If you are on a Windows platform, you can create a batch file and schedule it with the Windows scheduler.
    Or, if you are on Oracle 9i or 10g, you could use the external table feature instead of SQL*Loader. Then you could write a stored procedure to process the external table and schedule it using the Oracle scheduler (DBMS_JOB). This would probably be my preference.

  • HT4623 hy i need help i want to downgrade my iphone 4 from ios 6.0.1 to 5.1.1 how can i do because i dont like the ios 6.

    hy i need help i want to downgrade my iphone 4 from ios 6.0.1 to 5.1.1 how can i do because i dont like the ios 6. pls help thank

    There's no official way to do that. Downgrading was never supported since the first iPhone.

  • How can I copy a number of like fields and paste to reduce form creation time?

    How can I copy a number of like fields and paste to reduce form creation time?

    Creating Form Fields by Ted Padova

  • How can I get the attributes details like user name, mail , from sAMAccount csv or notepad file through powershell or any other command in AD?

    How can I get the attributes details like user name, mail , from sAMAccount csv or notepad file through powershell or any other command in AD?

    Ok what about If i need to get all important attributes by comparing Email addresses from excel file and get all required answers
    currently I am trying to verify how many users Lines are missing , Emp numbers , Phones  from AD with HR list available to me.
    I am trying to Scan all the AD matching HR Excel sheet and want to search quickly how many accounts are active , Line Managers names , Phone numbers , locations , title , AD ID .
    these are fields I am interested to get in output file after scanning Excel file and geting reply from AD in another Excel or CSV file
    Name’tAccountName’tDescri ption’tEma I IAddress’tLastLogonoate’tManager’tTitle’tDepartmenttComp
    any’twhenCreatedtAcctEnabled’tGroups
    Name,SamAccountName,Description,EmailAddress,LastLogonDate,Manager,Title,Department,Company,whenCreated,Enabled,MemberOf | Sort-Object -Property Name
    Can you modify this script to help me out :)
    Hi,
    Depending on what attributes you want.
    Import-Module ActiveDirectory
    #From a txt file
    $USERS = Get-Content C:\Temp\USER-LIST.txt
    $USERS|Foreach{Get-ADUser $_ -Properties * |Select SAMAccountName, mail, XXXXX}|Export-CSV -Path C:\Temp\USERS-ATTRIBUTES.csv
    #or from a csv file
    $USERS = Import-CSV C:\Temp\USER-LIST.csv
    $USERS|Foreach{Get-ADUser $_.SAMAccountName -Properties * |Select SAMAccountName, mail, XXXXX}|Export-CSV -Path C:\Temp\USERS-ATTRIBUTES.csv
    Regards,
    Dear
    Gautam Ji<abbr class="affil"></abbr>
    Thanks for replying I tried both but it did not work for me instead this command which i extended generated nice results
    Get-ADUser -Filter * -Property * | Select-Object Name,Created,createTimeStamp,DistinguishedName,DisplayName,
    EmployeeID,EmployeeNumber,Enabled,HomeDirectory,LastBadPasswordAttempt,LastLogonDate,LogonWorkstations,City,Manager,MemberOf,MobilePhone,PasswordLastSet,BadLogonCount,pwdLastSet,SamAccountName,UserPrincipalName,whenCreated,whenChanged
    | Export-CSV Allusers.csv -NoTypeInformation -Encoding UTF8
    only one problem is that Manager column is generating this outcome rather showing exact name of the line Manager .
    CN=Mr XYZ ,OU=Users,OU=IT,OU=Departments,OU=Company ,DC=organization,DC=com,DC=tk

  • In Jsp TagLib how can I get the Attribute value (like JavaBean) in jsp

    Dear Friends,
    TagLib how can I get the Attribute value (like JavaBean) in jsp .
    I do this thing.
    public void setPageContext(PageContext p) {
              pc = p;
    pc.setAttribute("id", new String("1") );
              pc.setAttribute("first_name",new String("Siddharth")); //,pc.SESSION_SCOPE);
              pc.setAttribute("last_name", new String("singh"));
    but in Jsp
    <td>
    <%=pageContext.getAttribute("first_name"); %>
    cause null is returing.
    Pls HELP me
    with regards
    Siddharth Singh

    First, there is no need to pass in the page context to the tag. It already is present. How you get to it depends on what type of tag:
    Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/SimpleTagSupport.html]SimpleTagSupport
    public class MyTag extends SimpleTagSupport
      public void doTag()
        PageContext pc = (PageContext)getJspContext();
        pc.setAttribute("first_name", "Siddharth");
        pc.setAttribute("last_name", "Singh");
        pc.setAttribute("id", "1");
    }Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html]TagSupport or it's subclass [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/BodyTagSupport.html]BodyTagSupport the page context is aleady declared as an implicit object:
    public class MyTag extends TagSupport
      public void doStartTag()
        pageContext.setAttribute("first_name", "Siddharth");
        pageContext.setAttribute("last_name", "Singh");
        pageContext.setAttribute("id", "1");
    }In each case, this sort of thing should work:
    <mytags:MyTag />
    <%= pageContext.getAttribute("first_name") %>I

  • In KA02 screen how can I get different functional area like (Production, Sales, Adminstration etc)

    In KA02 screen how can I get different functional area like (Production, Sales, Adminstration etc)

    Hi,
    Please check below configuration for defining functional areas for cost elements
    SPRO> FI > FI Global settings> company code> cost of sales accounting>Functional area > enter functional area
    Regards,
    Jyoti

Maybe you are looking for