About literal in PL/SQL

In the following SQL statement, which one is a literal
SELECT 'Employee Name: '| | ename from emp where deptno=10;
A. 10
B. ename
C. Employee Name:
D. | |
null

My understanding of "literal" is a hard-coded data value. Therefore the answer is A) because that is an actual department number.
"Employee Name:" is a string but I don't think it counts as a literal because it is concatenated with the data holder ename.
My tuppenceworth, APC

Similar Messages

  • A question about the impact of SQL*PLUS SERVEROUTPUT option on v$sql

    Hello everybody,
    SQL> SELECT * FROM v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0  Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    OS : Fedora Core 17 (X86_64) Kernel 3.6.6-1.fc17.x86_64I would like to ask a question about the SQL*Plus SET SERVEROUTPUT ON/OFF option and its impact on queries on views such as v$sql and v$session. Here is the problem
    Actually I define three variables in SQL*Plus in order to store sid, serial# and prev_sql_id columns from v$session in order to be able to use them later, several times in different other queries, while I'm still working in the current session.
    So, here is how I proceed
    SET SERVEROUTPUT ON;  -- I often activate this option as the first line of almost all of my SQL-PL/SQL script files
    SET SQLBLANKLINES ON;
    VARIABLE mysid NUMBER
    VARIABLE myserial# NUMBER;
    VARIABLE saved_sql_id VARCHAR2(13);
    -- So first I store sid and serial# for the current session
    BEGIN
        SELECT sid, serial# INTO :mysid, :myserial#
        FROM v$session
        WHERE audsid = SYS_CONTEXT('UserEnv', 'SessionId');
    END;
    PL/SQL procedure successfully completed.
    -- Just check to see the result
    SQL> SELECT :mysid, :myserial# FROM DUAL;
        :MYSID :MYSERIAL#
           129   1067
    SQL> Now, let's say that I want to run the following query as the last SQL statement run within my current session
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;According to Oracle® Database Reference 11g Release 2 (11.2) description for v$session
    http://docs.oracle.com/cd/E11882_01/server.112/e25513/dynviews_3016.htm#REFRN30223]
    the column prev_sql_id includes the sql_id of the last sql statement executed for the given sid and serial# which in the case of my example, it will be the above mentioned SELECT query on the employees table. As a result, right after the SELECT statement on the employees table I run the following
    BEGIN
        SELECT prev_sql_id INTO :saved_sql_id
        FROM v$session
        WHERE sid = :mysid AND serial# = :myserial#;
    END;
    PL/SQL procedure successfully completed.
    SQL> SELECT :saved_sql_id FROM DUAL;
    :SAVED_SQL_ID
    9babjv8yq8ru3
    SQL> Having the value of sql_id, I'm supposed to find all information about cursor(s) for my SELECT statement and also its sql_text value in v$sql. Yet here is what I get when I query v$sql upon the stored sql_id
    SELECT child_number, sql_id, sql_text
    FROM v$sql
    WHERE sql_id = :saved_sql_id;
    CHILD_NUMBER   SQL_ID          SQL_TEXT
    0              9babjv8yq8ru3    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;Therefore instead of
    SELECT * FROM employees WHERE salary >= 2800 AND ROWNUM <= 10;for the value of sql_text I get the following value
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES);Which is not of course what I was expecting to find in v$sql for the given sql_id.
    After a bit googling I found the following thread on the OTN forum where it had been suggested (well I think maybe not exactly for the same problem) to turn off SERVEROUTPUT.
    Problem with dbms_xplan.display_cursor
    This was precisely what I did
    SET SERVEROUTPUT OFFafter that I repeated the whole procedure and this time everything worked pretty well as expected. I checked SQL*Plus documentation for SERVEROUTPUT
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Could anyone kindly make some clarification?
    thanks in advance,
    Regards,
    Dariyoosh

    >
    and also v$session page, yet I didn't find anything indicating that SERVEROUTPUT should be switched off whenever views such as v$sql, v$session
    are queired. I don't really understand the link in terms of impact that one can have on the other or better to say rather, why there is an impact
    Hi Dariyoosh,
    SET SERVEROUTPUT ON has the effect of executing dbms_output.get_lines after each and every statement. Not only related to system view.
    Here below what Tom Kyte is explaining in this page:
    Now, sqlplus sees this functionality and says "hey, would not it be nice for me to dump this buffer to screen for the user?". So, they added the SQLPlus command "set serveroutput on" which does two things
    1) it tells SQLPLUS you would like it <b>to execute dbms_output.get_lines after each and every statement</b>. You would like it to do this network rounding after each call. You would like this extra overhead to take place (think of an install script with hundreds/thousands of statements to be executed -- perhaps, just perhaps you don't want this extra call after every call)
    2) SQLPLUS automatically calls the dbms_output API "enable" to turn on the buffering that happens in the package.Regards.
    Al

  • Literal arrays 'in' SQL clauses

    Hi All,
    I need some help with sql syntax in BPM.
    I get the following error when I run my query: Only literal arrays are allowed 'in' SQL clauses
    Here is my SQL query:
    SELECT *
    FROM Laptop.Dbo.INVENTORY
    WHERE inventoryid in (SELECT MAX(Laptop.Dbo.INVENTORY.inventoryid)from Laptop.Dbo.INVENTORY)
    Anyone know how to write it in BPM?

    Hi Lilach,
    Sure you tried this, but are you doing this with Dynamic SQL? If you use the code below, be sure to make sure the SQL in quotes runs ok from Squirrel or Toad. If your tables / columns have underscore characters, make sure this is included in the SQL. Change the name of the "extResource" variable to match the string you used when exposing the database in Studio.
    String query = "SELECT * FROM Laptop.Dbo.INVENTORY " +
                         "WHERE inventoryid in " +
                         "(SELECT MAX(Laptop.Dbo.INVENTORY.inventoryid)from Laptop.Dbo.INVENTORY)";
    String extResource = "YourExternalResourceNameHere";
    // this only will return one row so it will enter to loop and immediately leave
    foreach (row in DynamicSQL.executeQuery(sentence : query, implname : extResource)) {
        display("Here's your returned value: " + row["inventoryid"]);
    }Dan

  • About creating functions in SQL Developer

    I have successfully installed Oracle SQL Developer.Also I have got a book on Oracle SQL Developer by Dan Hotka.
    After going through the book I could not a solution for creating and compiling functions without any errors.

    What errors?
    How about going through the tutorial inside the online help (Help - Table of Contents - Tutorial)?
    Have fun,
    K.

  • Question about B1if-Database in SQL-Mgmt-Studio

    Hello,
    We have made some changes in the configuration in SLD.
    We made some more Di-Proxy-Ports and then made Proxygroups for the Databases.
    Nearly every half hour, in SQL-Mgmt Studio we can see this "task" ?
    During the time, this task is online, the Queue-Monitor collects all Jobs... but not more.
    After this Job has finished... B1i begins to work up the jobs.
    Can anyone tell me something about "Rollback Transac" in  B1if-Database ?
    Thanks
    Markus

    Passing the exam and becoming certified are not a matter of simply reading a book or taking a training class. While books and classroom materials as well as in-class training are all important steps in preparing for an exam, experience and research are just as important. I cannot tell you that there are 53 questions on the exam and every single question maps directly back to page 13, paragraph 3 in XX book. However, If you have the classroom material, and you have the list of exam topics, you should be able to find most of the information you need. In some cases, if you are not completely familiar with a specific topic, or you don't feel like the information in the book gives you all the information you need, you may need to do a little additional research. This is all part of preparing for an exam. This process is what makes you successful as a certified professional.
    Your focus seems to be solely on the course materials that you have and what volumes and chapters you should read. I'm trying to give you a different perspective - preparing for an exam is not necessarily about taking one course or reading one book and being ready. You need to review the exam topics and be sure that you are familiar with each topic.
    Regards,
    Brandye Barrington

  • About Optimization Of PL/SQL Constructs

    Hi All,
    I am asking very silly question, some one asked to me how to optimize pl/sql procedure or function.i had explained all the things for optimization of the sql query or we can put the pl/sql subprogram into package.
    But from the face expression of the person,i think he wants more from my side,but really i did not know any thing except of these things.
    I want to know ideas of the experts on this issue.
    Thanks a lot

    If by optimization that person was asking about techniques then there are a few general rules. Keeping in mind that general rules are starting points and require validation is every specific case.
    1. Never use PL/SQL to do what you can do with SQL.
    2. Never use single-row processing when you can process a set
    So, for example, you can write three anonymous blocks to do some piece of work ... one that uses SQL such as:
    BEGIN
      INSERT INTO t1
      SELECT * FRM t2;
      COMMIT;
    END;
    Then another that does the same thing with BULK COLLECT and FORALL and finally a third using a cursor loop. Which will be fastest and more efficient doing the same work is reasonably certain.
    The second interpretation of the question would be how does one determine the efficiency of PL/SQL and for that I would refer you to the built-in DBMS_PROFILER (10g and before) and DBMS_HPROF (11g) packages.
    There are a number of authors that have written very good materials on the subject among which I would suggest you explore asktom.oracle.com, Tom Kyte's many excellent books and Steven Feuerstein. There are many others but this will give you a good starting point.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Asking about the most simplest SQL technique

    select table1.field1,table1.field2
    from table1, table2
    where table2.category = 'A' and
    table1.pk = table2.fk
    =========================================
    If table1 contains 500 records while table2 contain 400,000 records, then table2 should be placed to the most righthand side ?
    If table2 has 1000 category 'A' record while
    table2 has 80,000 records contain the pk of table1, then table1.pk = table2.fk should be placed on the most lower part in the where clause ?

    It used to be the case that you had to consider these issues with some DBMS's, but generally not any more.
    Sophisticated systems like Oracle can maintain sets of statistics on tables, and on the distribution of values within fields. If the DBA chooses to, he can run commands to make Oracle analyze individual tables and columns, and the statistics produced will be considered when choosing an access path for the data.
    So, the database will know how many records are in the tables in your example query, and roughly how many category 'A' records are in table2 etc.. It will also know whether there are indexes on the columns, and will work out roughly how many bytes must be read to return the result depending on whether the indexes are used, which table is scanned first, and what join technique should be used.
    Look in the Oracle documentation for the description of the ANALYZE command, the SQL*Plus command "set autotrace traceonly explain", and in the section on performance have a read of everything to do with the optimizer. It's an important area to know more about if you want to get the most out of Oracle, and is quite an eye-opener if you are moving to Oracle (or any complex RDBMS) frm simpler products (Foxpro, Access etc). Good luck.

  • Ask about an Error in SQL 2014

    Hi all,
    I got an error in SSIS package when I upgraded from Sql server 2008 to 2014 as below
    I have a format file with "Text qualifier" is "||" and "Column dilimiter" is "|" as below data example and it run well in SSIS 2008. But I got an error after I upgraded to Sql server to 2014 because SSIS 2014 did not
    know this kind of format. Is this a bug for new Sql 2014?
    As I know, some first releases of Sql server 2008 also had this error and then it's fixed after that. Now, it happen again in new release of Sql server 2014. Is there any fix for that?
    Error: "[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED.  The PrimeOutput method on MediaType returned error code 0xC0202091.  The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning
    of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.  There may be error messages posted before this with more information about the failure."
    Example data:
    ||MediaTypeID|||||MediaTypeCode||
    ||xxx|||||yyy||
    ||ccc|||||zzz||
    Thanks all.

    Hi khoana,
    Based on my research, the issue is caused by the Column Delimiter gets first preference and then Text Qualifier. So the values would be parsed as 10 columns based on the Column Delimiter, lack of Text Qualifier cause the issue. This is by design in SQL Server
    2014.
    Personally, I recommend you that submit the requirement at
    https://connect.microsoft.com/SQLServer/. If the requirement mentioned by customers for many times, the product team may consider to add this feature in the next SQL Server version. Your feedback is valuable for us to improve our products and increase
    the level of service provided.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • About cluster table in sql server or SAP

    Hello Gurus,
            we have a cluster table "KONV" in our sql server 2008 , is that feature for cluster table native feature in sql server or in sap?
    because some professonal said there is no concept for cluster table in sql server just like oracle database. so please help me for
    clarification.
    Many thanks,

    I agree, this is ABAP Dictionary specific way of data encapulation, not the DB type dependant one. Basically it stores the data in RAW or LRAW format.
    Also be aware that we distinguish b/w [data clusters|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm] and [cluster tables|http://help.sap.com/saphelp_nw04/helpdata/en/cf/21f083446011d189700000e8322d00/content.htm].
    Regards
    Marcin

  • Question about using objects in SQL query.

    I had posted this question in the SQL/PLSQL forum but I guess nobody took the time to understand exactly what I am asking so I decided to try here hoping to get the answer. So here is the thing:
    I have created generic object type "tree" - the constructor takes as a parameter sql query which returns "node_id" and "parent_node_id" - this is all we need to have a tree. The object has all related to a tree structure member functions and one of them is "oldest_relative" (the tree may not be fully connected - it may be more like a set of many trees, so it's not necessary all nodes to have the same root).
    I also have departments table with the following fields: department_id, parent_department_id, department_name,...
    all records in the table w/out parent_departments (parent_department_id is null) are considered divisions.
    Now if I run the following query:
    SELECT "DEPARTMENT_ID", "PARENT_DEPARTMENT_ID", "DEPARTMENT_NAME", tree('select department_id "node_id", parent_department_id "parent_node_id" from departments').oldest_relative("DEPARTMENT_ID") "DIVISION_ID" FROM departments
    my question is: Is the tree object created for every row or does Oracle somehow caches the object since the object itself is not changing but only the parameter for the oldest_relative member function.
    The table only has a few hunderd records and I can't see much of a difference in the execution time btw the query above and query like this:
    SELECT "DEPARTMENT_ID", "PARENT_DEPARTMENT_ID", "DEPARTMENT_NAME", b.t.oldest_relative("DEPARTMENT_ID") "DIVISION_ID"
    FROM departments left join (select tree('select department_id "node_id", parent_department_id "parent_node_id" from departments') t from dual) b on 1 = 1
    where the object is clearly created just ones. (there is probably a better way to do it instead of this join)
    Pls elaborate
    George

    Not exactly sure what the question is...
    As I understand, you are comparing the following two constructor calls:
    +select..  tree('select department_id "node_id", parent_department_id "parent_node_id" from departments').oldest_relative("DEPARTMENT_ID") ... FROM ...+
    +select tree('select department_id "node_id", parent_department_id "parent_node_id" from departments') ... FROM dual+
    These calls are the same (besides the 1st one doing an immediate implicit call to a method of the object being constructed). The number of times these are being called depends on the number of times this SQL projection is applied - and that is determined by the number of rows being projected by the SELECT.
    The latter one is against DUAL which only has a single row. So that constructor is only called once. The former can be against multiple rows. Obviously a single pass through a data set is desirable - which means that the sub-select (use by the constructor) should ideally only be executed once and makes the 2nd method more desirable.
    However, I'm having a hard time understanding why the class and constructor are at all needed. Why pull data from a SQL table into PL memory? As that is where the class will need to cache and store the results of that construction parameter SQL SELECT. And once in PL memory, how does the object effectively access, search and use this cached data?
    PL memory is expensive. It is not sharable.
    PL data structures are primitive - these cannot be compared to SQL structures in the form of tables and columns that can be stored in a number of physical ways (index tables, hash tables, partitioned tables, clustered tables, etc). Cannot be indexed like SQL structures using B+tree, bitmap, function and other indexing methods. Cannot be sorted, grouped, analysed, filtered, etc like SQL structured data.
    It makes very little sense to read SQL data into a class and then deal with that data, cached in expensive PL memory, using primitive PL structures.
    And the same would be true if Java or C# was used. The best place for data is inside the SQL engine. That is the most superior environment for data. It can processes more data, scale better, perform better and offer more flexibility, than pulling data from it and then crunch that data using PL or Java or C#.

  • Question about 'direct' parameter in sql loader utility

    Hi eveyone,
    Today I was asked what the advantages and disadvantages of 'direct' parameter of sql loader.
    In my opinion, if swithing direct on, oracle use direct path load.
    And it has no difference from the append hind in insert statement.
    The core merits are less redo hence faster.
    The main shortcoming is since little redo generated, we have to ask DBA to back up the data according to the rules immediately after the loading.
    Does my answer make sense or not? Plesae help to point out the important things I missed.
    best regards,
    Leon

    Hi,
    Direct path Export is much faster than conventional path Export because the data is read from disk into the buffer cache and rows are transferred directly to the Export client.
    Some conditions to use DIRECT parameter are,
    1. The Export parameter BUFFER applies only to conventional path Exports. For direct path Export, use the RECORDLENGTH parameter to specify the size of the buffer that Export uses for writing to the export file.
    2. You cannot use direct path when exporting in tablespace mode (TRANSPORT_TABLESPACES=Y).
    3. The QUERY parameter cannot be specified in a direct path Export.
    Thanks

  • Another question about using objects in SQL queries

    Hi gurus, I need your thoughts on this:
    I have created generic object type "tree" - the constructor takes as a parameter sql query returning "node_id" and "parent_node_id". As a tree - the object has all related to a tree structure member functions and one of them is "oldest_relative" (the tree may not be fully connected - it may be more like a set of many trees, so it's not necessary all nodes to have the same root).
    I also have departments table with the following fields: department_id, parent_department_id, department_name,...
    all records in the table w/out parent_departments (parent_department_id is null) are considered divisions.
    Now if I run the following query:
    SELECT "DEPARTMENT_ID", "PARENT_DEPARTMENT_ID", "DEPARTMENT", tree('select department_id "node_id", parent_department_id "parent_node_id" from departments').oldest_relative("DEPARTMENT_ID") "DIVISION_ID" FROM departments
    my question is: Is the tree object created for every row or does Oracle somehow caches the object since the object itself is not changing but only the parameter for the oldest_relative member function.
    The table only has a few hunderd records and I can't see much of a difference in the execution time btw the query above and query like this:
    SELECT "DEPARTMENT_ID", "PARENT_DEPARTMENT_ID", "DEPARTMENT", b.t.oldest_relative("DEPARTMENT_ID") "DIVISION_ID"
    FROM departments left join (select tree('select department_id "node_id", parent_department_id "parent_node_id" from departments') t from dual) b on 1 = 1
    where the object is clearly created just ones. (there is probably a better way to do it instead of this join)
    Pls elaborate
    George

    Hi, TREE is not a function but PL/SQL object type I have written representing tree structure. The Oracle version is 10g.

  • Information about constraints by using SQL query?

    Hi
    how can we view all the definition of a constraint by using SQL query.
    Suppose I create following tables:
    CREATE TABLE supplier
    ( supplier_id numeric(10) not null,
    supplier_name varchar2(50) not null,
    contact_name varchar2(50),
    CONSTRAINT supplier_pk PRIMARY KEY (supplier_id, supplier_name)
    CREATE TABLE products
    ( product_id numeric(10) not null,
    supplier_id numeric(10) not null,
    supplier_name varchar2(50) not null,
    CONSTRAINT fk_supplier_comp
    FOREIGN KEY (supplier_id, supplier_name)
    REFERENCES supplier(supplier_id, supplier_name)
    ON DELETE CASCADE
    e.g. CONSTRAINT fk_supplier_comp: Plz write me the SQL query that tells that this is a FOREIGN KEY (supplier_id, supplier_name) and REFERENCES supplier(supplier_id, supplier_name) .....etc.
    thanks

    You mean "What is an Oracle Metalink?"
    Then, Oracle Metalink (www.metalink.oracle.com) is an official web site of Oracle Corporation. This is the area where you can get an ultimate and immediate fixes for any sort of Oracle/Issues/Problems. And also, Patches/fixes/Notes/Procedures can be used as reference and can be downloaded from this.
    Note: Sharing of Oracle Metalink information/credentials is highly illegal act.
    Fore more information and benefits on Oracle Metalink, please take a look at the below URL.
    http://www.oracle.com/support/premier/metalink.html
    Regards,
    Sabdar Syed.

  • Question about reconciliation, by using SQL statement

    Dear All,
    Does any know how to print out A/R invoice which are internally recon, by using SQL statement. It seems like GL report.
    For example:
    InvoiceNo                     Recon
    INV222000001              Yes
    INV222000002              No
    INV222000003              No
    From Samson

    Dear Samson,
    Please try this one:
    SELECT T0.DocNum AS 'Invoice No.',  CASE WHEN SUM(T1.IntrnMatch)=0 THEN 'NO' ELSE 'YES' END AS Recon
    FROM DBO.OINV T0
    INNER JOIN DBO.JDT1 T1 ON T1.TransId = T0.TransId
    WHERE T0.DocDate BETWEEN [%0\] AND [%1\]
    GROUP BY T0.DocNum
    Thanks,
    Gordon

  • About HTTP Server--PL/SQL Properties

    When I click link 'PL/SQL Properties' on HTTP Server page
    It display a blank page,and can not display normally
    When I reboot server,It only display normally once,and once again click it,the blank page appeared.
    I used Oracle 9iAS R2
    Can u help me?

    What Navigator for Internet is???
    And what version???

Maybe you are looking for

  • MSI K7N2 Delta ILSR - Noisy Grinding Motherboard Fan

    Hi, The Motherboard Fan on my MSI K7N2 Delta ILSR has started to make a terrible grinding noise and I was hoping someone could offer some help on how to replace it. Some of the questions I have are -  + Is the Motherboard Fan screwed on or glued on?

  • ABZU write up with strange 'ordinary depreciation on transaction' amount

    Hi gurus, After I use ABZU to write up an asset for certain amount, e.g. $200 and check the asset document with AB03, there is always a strange amount like -176.33 in the 'ordinary depreciation on transaction' field with the 'ordinary depreciation' a

  • Excel to Adobe PDF page size problems

    I am using Excel 2007 on a Windows XP setup with Acrobat 9.0 PDFM OfficeAddin.  I want to convert my Excel sheets to 8.5"x11" size pages, but they come out as approx. 22"x30" pages.  I've checked the page size setting in Excel and the Adobe preferenc

  • Org unit changes but position not  when emp move from 1 org unit 2 other

    Hi, We have a scenario in which when an employee moved from org unit to another (temporarily) his position doesn't get changed but org. unit changes. How to manage it??? Thanks in advance Anand

  • Oracle AQ dequeue process

    Hi, i found one strange thing in dequeue process. I have a trigger (after insert) called trigA that perform enqueue process,and it is attached to a table called Student. And i have a stored procedure called notifyDeq that has beed registered to recei