SQL query to return limited number of characters

Hi,
I had a SQL report that queries all columns out from a table. One column contains description which usually has character size > 300. How can I format the returning description text to a limited size of character? (for example, 100)
==
SELECT "TITLE", "DESC", "AUTHOR"
FROM NEWS_LETTER

Tony,
Try:
SELECT "TITLE",
SUBSTR("DESC", 1, 100) short_desc,
"AUTHOR"
FROM NEWS_LETTER

Similar Messages

  • Coding - returning the number of characters in a text box.

    I am in the process of creating a cell phone simulation/animation in Edge Animate CC for use in a Captivate course. Basically, when a user clicks on number buttons on the virtual keypad, it displays the numbers in a text box , just like an actual cell phone would display the phone number on the screen as a caller is dialing. So, the user would click seven buttons and a seven-digit phone number appears on the virtual phone screen.  This part of my animation works great and all seven digits appear, but I would like to modify the code so that a hyphen appears after the third button clicked. This way, the output better resembles an actual phone number instead of just a string of seven digits.
    Here is an example of the code I currently have assigned to the #2 button on the virtual keypad:
    var text = sym.$("PhoneNum").html();
    text = text + 2;
    sym.$("PhoneNum").html(text);
    PhoneNum is the name of my text box on the stage where the digits appear as each keypad button is clicked.
    In order to incorporate the hyphen after the third button clicked, I need to somehow return the current number of characters in the PhoneNum text box, then create an if/else scenario that applies the hyphen after the third button clicked.
    Does anyone know how I can use either JavaScript or jQuery to return the number of characters currently in the PhoneNum text box?

    No problem!
    Basically the thing to remember is that unless you are needing to pass html to the object, you can use text() instead. text() also gives you the raw text without any html formatting (so you can assume what .html() would return)

  • SQL query  which return all the NET SERVICES which are avaiable in tnsname

    hi all
    how to write a sql query which return all the net services which are avaiable in tnsname.ora
    Regards
    s

    Also, tnsnames.ora is stored on the client, and not necessarily on the server; it's possible (and quite likely) that the name I use for a database in my tnsnames.ora could be different from the name you use for the same database; conversely we might use the same name for two different databases.
    Regards Nigel

  • Why is asking a question to Firefox so difficult, and limited to a limited number of 'characters'?

    Why is asking a question to Firefox so difficult, and limited to a limited number of 'characters'?

    Sorry for the confusion; it seems as though I am the one confused--after jumping through several hoops, I thought I was sending a question to the Firefox help support...my question was about 7 characters too long to send, apparently.

  • SQL- Query that return only one record

    Hello,
    is it possible to execute a pure SQL-Query which returns only one row although multiple rows are found.
    It is no problem in PL/SQL, but I have no idea if the same is also possible in SQL.
    thanks in advance
    Michael

    Why not? There are 4 records in this table, but only selected one.
    SQL> with t
      2  as
      3  (
      4     select '#%$@#$@$@##$' Addr from dual
      5     union all
      6     select '18 Jalan Scott' from dual
      7     union all
      8     select '18 Lemana St' from dual
      9     union all
    10     select '32-penstation' from dual
    11     union all
    12     select '99999999999' from dual
    13  )
    14  select addr
    15    from t
    16   where rownum =1
    17  /
    ADDR
    #%$@#$@$@##$
    SQL>Cheers
    Sarma.

  • Sql query to retrieve  st number

    Hi,
    I would like to query a street number column(varchar2) from address table.
    st number could be any one of following.
    1.1234
    2.AHh-500
    3.1700/2
    4.15-A or 15A
    in this case, i should get only values with numberic not any alpha or special character.
    Query should return case 1, not case 2.
    in case of case 3 or 4, query should return 1700 or 15(i.eif st num starts with number and has non numberic characters, it shud return only numerics)
    Could anyone please post the query for this scenario?

    Never fear, the regex man is here ... scnr. ;-) In 10g1, how about this:
    WITH t AS (SELECT '1234' street
                 FROM dual
                UNION
               SELECT 'AHh-500'
                 FROM dual
                UNION
               SELECT '1700/2'
                 FROM dual
                UNION
               SELECT '15-A'
                 FROM dual
                UNION
               SELECT '15A'
                 FROM dual
    SELECT t.*, REGEXP_SUBSTR(t.street, '^[[:digit:]]+') street_number
      FROM t;            Using this as filter:
    SELECT *
      FROM (SELECT t.*, REGEXP_SUBSTR(t.street, '^[[:digit:]]+') street_number
              FROM t
    WHERE street_number IS NOT NULL
    ;C.

  • How to check the sql:query is return null value

    I have use :
    <sql:query var="sql1" dataSource="${db}">
    select col_name from table_name
    where a=<c:out value="${row.test1}"/>
    and b='<c:out value="${row.test2}"/>'
    </sql:query>
    So, how can I check this statement return null value which is no record within this table?

    The Result should never be null but can be empty. You can check if the Result is empty using an if tag and checking the rowCount property:
        <sql:query var="books"
          sql="select * from PUBLIC.books where id = ?" >
          <sql:param value="${bookId}" />
        </sql:query>
         <c:if test="${books.rowCount > 0}">
         </c:if>http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL7.html#wp84217
    Look for query Tag Result Interface

  • SQL Query to return all the dependent objects

    Hi,
    I have a question.
    Suppose I am creating a table with a join on 10 other tables, views etc..
    And there are nested sub-queries in the CREATE statement.
    How can I get the list of all the dependent objects for that table without counting them manually.
    I know, we can right click the table/view name and check the dependent objects in Toad or SQL Developer.
    But, I want to know the SQL query for getting that information.
    Thanks
    Rajiv

    well there is no way oracle would know what query was used when the table was created.
    But here is one intuitive trick:
    Step 1: Create a procedure that will have a cursor declared on the query you want to know what tables/views are used.
    Step 2: Check USER_DEPENDENCIES to see what objects this procedure depends on
    Let say you want to create TEST_A table using the following statement:
    create table test_a
    as
    select *
    from scott.emp,
         scott.dept;
      1  create or replace procedure test_temp
      2  as
      3  cursor test_cur is
      4             select *
      5             from scott.emp,
      6                  scott.dept;
      7  begin
      8     null;
      9* end;
    SQL> /
    Procedure created.
    SQL> show errors
    No errors.
    SQL> desc user_dependencies
    Name                                      Null?    Type
    NAME                                      NOT NULL VARCHAR2(30)
    TYPE                                               VARCHAR2(17)
    REFERENCED_OWNER                                   VARCHAR2(30)
    REFERENCED_NAME                                    VARCHAR2(64)
    REFERENCED_TYPE                                    VARCHAR2(17)
    REFERENCED_LINK_NAME                               VARCHAR2(128)
    SCHEMAID                                           NUMBER
    DEPENDENCY_TYPE                                    VARCHAR2(4)
    SQL> select referenced_owner, referenced_name, referenced_type
      2  from user_dependencies
      3  where name='TEST_TEMP' and referenced_owner<>'SYS';
    REFERENCED_OWNER
    REFERENCED_NAME
    REFERENCED_TYPE
    SCOTT
    DEPT
    TABLE
    SCOTT
    EMP
    TABLE
    SQL>
    SQL> drop procedure test_temp;
    Procedure dropped.
    SQL>Message was edited by:
    tekicora
    Message was edited by:
    tekicora

  • SQL Query to return multiple transactions in a 5 min. period

    I have been asked to write a query that scans a table of financial transactions looking for more than 1 transaction by the same person (EmplID for example) within a 5 minute period. I am not sure if this is possible with SQL. Here are the details:
    Table = MEALTRANSLEDGER
    Relevant Columns:
    "TRANDATE" DATE,
    "EMPLID" NUMBER(9,0)
    I need to select these columns when a particular EmplID has logged more than 1 transaction in a 5 minute period.
    I know I could do this with PL/SQL or Perl by stepping through the rows of the table and calculating date differences, but I would really like to know if SQL could do it.
    Thanks for the help.
    Version Info:
    SQL> select * from v$version where banner like 'Oracle%';
    BANNER
    Oracle Database 10g Release 10.2.0.4.0 - Production

    You can use something along these lines to determine the minutes difference between transactions...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as emplid, to_date('01/01/2010 09:00:00', 'DD/MM/YYYY HH24:MI:SS') as trandate from dual union all
      2             select 1, to_date('01/01/2010 09:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      3             select 1, to_date('01/01/2010 09:20:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      4             select 1, to_date('01/01/2010 09:45:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      5             select 1, to_date('01/01/2010 09:51:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      6             select 2, to_date('01/01/2010 09:12:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      7             select 2, to_date('01/01/2010 09:18:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      8             select 2, to_date('01/01/2010 09:22:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      9             select 2, to_date('01/01/2010 09:30:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
    10             select 3, to_date('01/01/2010 09:05:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
    11             select 3, to_date('01/01/2010 10:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
    12             select 3, to_date('01/01/2010 11:15:00', 'DD/MM/YYYY HH24:MI:SS') from dual
    13            )
    14  --
    15  select emplid, trandate
    16        ,(trandate-lag(trandate) over (partition by emplid order by trandate)) * (24*60) as mins_diff
    17  from t
    18* order by emplid, trandate
    SQL> /
        EMPLID TRANDATE             MINS_DIFF
             1 01/01/2010 09:00:00
             1 01/01/2010 09:10:00         10
             1 01/01/2010 09:20:00         10
             1 01/01/2010 09:45:00         25
             1 01/01/2010 09:51:00          6
             2 01/01/2010 09:12:00
             2 01/01/2010 09:18:00          6
             2 01/01/2010 09:22:00          4
             2 01/01/2010 09:30:00          8
             3 01/01/2010 09:05:00
             3 01/01/2010 10:10:00         65
             3 01/01/2010 11:15:00         65
    12 rows selected.And then you can wrap that up to just highlight the problem ones...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as emplid, to_date('01/01/2010 09:00:00', 'DD/MM/YYYY HH24:MI:SS') as trandate from dual union all
      2             select 1, to_date('01/01/2010 09:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      3             select 1, to_date('01/01/2010 09:20:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      4             select 1, to_date('01/01/2010 09:45:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      5             select 1, to_date('01/01/2010 09:51:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      6             select 2, to_date('01/01/2010 09:12:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      7             select 2, to_date('01/01/2010 09:18:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      8             select 2, to_date('01/01/2010 09:22:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
      9             select 2, to_date('01/01/2010 09:30:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
    10             select 3, to_date('01/01/2010 09:05:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
    11             select 3, to_date('01/01/2010 10:10:00', 'DD/MM/YYYY HH24:MI:SS') from dual union all
    12             select 3, to_date('01/01/2010 11:15:00', 'DD/MM/YYYY HH24:MI:SS') from dual
    13            )
    14  --
    15  select emplid, trandate
    16  from (
    17        select emplid, trandate
    18              ,(trandate-lag(trandate) over (partition by emplid order by trandate)) * (24*60) as mins_diff
    19        from t
    20       )
    21  where mins_diff <= 5
    22* order by emplid, trandate
    SQL> /
        EMPLID TRANDATE
             2 01/01/2010 09:22:00
    SQL>

  • SQL query to return list of table names.

    Hi all,
    I'm looking for a query that will return a list of the table names that exist in my Microsoft Access database.
    Any ideas?

    http://forum.java.sun.com/thread.jsp?forum=31&thread=348287
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DatabaseMetaData.html
    I would suggest you strat to use the search at the upper right.
    You can leave it blank and the advanced search will appear.
    You can then select the specific areas you want to search.

  • Query not returning correct number of records

    Hi Guys,
    Can someone please tell me why this query is not retrieving the correct number of records.
    I have a table with six users
    FIRST_NAME          LAST_NAME
    David               Robert
    Martin               Fisher
    Henry               Robert King
    Edmund               Tomkinson
    Williams          Hayes Robert
    Tina               Belkins
    When I run a query, SELECT * FROM USERS WHERE LAST_NAME LIKE 'Robert';
    I only get 1 record back (David Robert). Is the space between the last name
    causing this? If yes, How can I rewite the query?

    show a copy-paste example of your query...
    you need to use a wild card with LIKE, as in
    SQL> create table test
      2  (first_name varchar2(50)
      3  ,last_name varchar2(50)
      4  );
    Table created.
    SQL>
    SQL> insert into test values ('David' , 'Robert'           );
    1 row created.
    SQL> insert into test values ('Martin', 'Fisher'           );
    1 row created.
    SQL> insert into test values ('Henry' , 'Robert King'      );
    1 row created.
    SQL> insert into test values ('Edmund', 'Tomkinson'        );
    1 row created.
    SQL> insert into test values ('Williams',  'Hayes Robert');
    1 row created.
    SQL> insert into test values ('Tina',  'Belkins');
    1 row created.
    SQL>
    SQL> SELECT * FROM test WHERE LAST_NAME LIKE 'Robert';
    FIRST_NAME
    LAST_NAME
    David
    Robert
    SQL>
    SQL> SELECT * FROM test WHERE LAST_NAME LIKE '%Robert%';
    FIRST_NAME
    LAST_NAME
    David
    Robert
    Henry
    Robert King
    Williams
    Hayes Robert

  • Bex query that returns variable number of columns based upon variable value

    I have a request to create a query that, at excution time, has a variable for 'nbr of months', and based on the value entered by the user, returns data for only the specified number of months. Value that can be entered can vary from 1 to 12. A simple example is, if the user enters 1, then they would only want to see one column, and if they entered 6, then they'd like to see 6 columns in the workbook.  All suggestions on how to implement this dynamic columns on a workbook will be appreciated.
    Thanks.
    BN

    Hi,
    Do this->
    1) first create a New Structure in Rows-> Place your New Selection and drag your KF.
    2) Nw Create a New Formual under this structure. Now Create a Formula variable ( "ZFVXXX")with user-entry and ready for input and dimension as NUmber. and place in formula area. And hide this formula.
    3)Now Create a New Customer-Exit variable on 0CALMONTH name as "ZCECMON" with following atrribute->Mandatory, Range(Interval) and remove check for Ready for entry.
    4)Drag your 0CALMONTH in Rows above That Structure and restrict it to "ZCECMON".
    5) Now go to CMOD and write this code.
    INCLUDE ZXRSRU01 *
    DATA: L_S_RANGE TYPE RSR_S_RANGESID. 'In global area
    DATA: LOC_VAR_RANGE LIKE RRRANGEEXIT. 'In global area
    DATA: zmonth like /bi0/0calmonth.
    CASE I_VNAM.
    WHEN 'ZCECMON'.
    IF i_step = 2.
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'ZFVXXX'.
    zyear = sy-datum(4).
    zmonth = sy-datum+4(2).
    l_s_range-low = zmonth.
    zmonth = zmonth + loc_var_range-low.
    l_s_range-HIgh = zmonth.
    l_s_range-sign = 'I'.
    l_s_range-opt = 'BT'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDCASE.
    6) activate the porject and go to rsrt and run there first.
    Regards,
    San!
    Message was edited by: San!

  • ABAP query not returning correct number of records

    Hi,
    I have created an ABAP Query using logical database VFV and nodes VBRK, VBUK and VBRP.
    But, after entering values for Sales Organisation ( VBRK-VKORG ), Distribution channel ( VBRK-VTWEG ) and Date ( VBRK-FKDAT), the number of records that I get are very less in number as compared to the actual number in the database.
    Please give some pointers to the reason. I have set Lines 60 and Columns length - 83 and selected ALV List.
    Regards,
    Garima.

    Hi Garima,
    Please Check whether you are selecting all the Key fields in your Query.
    Thanks & Regards,
    Ashok kumar.

  • Sql query to  know the number of triggers and cursors present in a schema?

    friends,is there any way to know the number of triggers and cursors preseent in a schema.
    thanks in advance..

    what do you mean by triggers in a schema? is it the triggers owned by that schema? or the triggers applied on tables owned by that schema? remember you may own triggers applied on the tables belong to other schemas. Anyways, all this information can be extracted from oracle dictionary using a combination of all_triggers and all_tables.
    As far as cursors, please elaborate. Do you mean cursors declared in PL/SQL blocks?

  • SQL query that returns exclusive rows from groups

    I'm using modified scott/tiger data for this.
    I've got two tables
    DEPT_X
    DEPTNO     DNAME             LOC     CODE_ID     SUB_DEPTNO
    10     ACCOUNTING     NEW YORK 111     101
    10     SALES             ATWN      111     102
    10     SALES             BTWN      112     103
    20     RESEARCH     DALLAS      111     201
    20     RESEARCH     CTWN      111     202
    30     SALES             CHICAGO      111     301
    40     OPERATIONS     BOSTON      112     401and
    BI_PD
    CODE_ID     PD_TYPE     BI_TYPE
    111          -1
    112     -1     I want to write a query that joins the code_ids of the two tables and lists out either only the records from DEPT_X who's code_ids have a -1 in the PD_TYPE(112) column and none of the code_ids that have a -1 in the BI_TYPE(111) column for each department or if that department has code_ids for the BI_TYPE (111), list out those rows. So for Deptno 10 you'll only get the row with SUB_DEPTNO = 103. But if for that DEPTNO= 20 you'll get the rows for both SUB_DEPTNO = 201 and 202.
    So the result should look like
    DEPTNO   SUB_DEPTNO
    10          103
    20          201
    20          202
    30          301.
    Basically I just want rows from each department that have code_ids = 111 not to show up if there are code_ids = 112.
    What is the query to do this?
    Message was edited by:
    user623359
    Message was edited by:
    user623359
    Message was edited by:
    user623359
    Message was edited by:
    user623359
    Message was edited by:
    user623359

    One way could be:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> with dept_x as (
      2      select 10 deptno, 'ACCOUNTING' dname, 'NEW YORK' loc, 111 code_id, 101 sub_deptno from dual
    union all
      3      select 10, 'SALES', 'ATWN', 111, 102 from dual union all
      4      select 10, 'SALES', 'BTWN', 112, 103 from dual union all
      5      select 20, 'RESEARCH', 'DALLAS', 111, 201 from dual union all
      6      select 20, 'RESEARCH', 'CTWN', 111, 202 from dual union all
      7      select 30, 'SALES', 'CHICAGO', 111, 301 from dual union all
      8      select 40, 'OPERATIONS', 'BOSTON', 112, 401 from dual ),
      9  --
    10  bi_pd as(
    11      select 111 code_id, null pd_type, -1 bi_type from dual union all
    12      select 112, -1, null from dual),
    13  --
    14  t as(
    15      select a.deptno,a.sub_deptno from dept_x a, bi_pd b
    16      where a.code_id = b.code_id and b.pd_type = -1)
    17  --
    18  select a.deptno,a.sub_deptno
    19  from dept_x a, bi_pd b
    20  where a.code_id = b.code_id and b.bi_type = -1 and 
    21        (a.deptno) not in (select deptno from t)
    22  union
    23  select deptno,sub_deptno from t;
        DEPTNO SUB_DEPTNO
            10        103
            20        201
            20        202
            30        301
            40        401

Maybe you are looking for

  • Restart JDBCSystemResource in WLST

    I posted this question in the JDBC forum, but I realize it might me more appropriate here. I'm trying to change the database connection for all existing JDBC Data Sources in WLST (Weblogic Server 10.3.4), to make it connect to a different database wh

  • Safari 8.0.4 crashes at every start after update

    Hi! Hope anybody can help me. After update of Safari to 8.0.4, Safari crashes every time after starting the app! Safari is not usable anymore! No problems with other browser. Here the failure report: Date/Time:       2015-04-06 07:55:53 +0200 OS Vers

  • Use of when function with linking sheets

    Hello, So I went through the Manual and the Forum. There is no German Forum so WENN means IF and WAHR means TRUE; If I enter this function: =WENN(G6=WAHR;"=Blatt 3 :: Tabelle 1 :: B6";"nix") it respondes in case of RIGHT the string "Blatt 3 :: Tabell

  • Black screen and if sleep button pressed there's green lines like the matrix!

    what do i do? my ipad was just working when i was getting ready for work and at work earlier today and i got home to check emails my screen wouldnt work! its a black screen and if the power/sleep button on top or even the home button is pressed then

  • J2E startup problem

    I just installed the J2E full trial on a laptop that already has a NSP instance installed.I get a Half Green/ Half Yellow icon in the MMC when I start the J2E server.The 01 instance is always yellow and never progresses onto green. I have a process s