get the maximum length of the data in the column varchar2

create table test as
(text varchar2(100)
This column is configured as shown in the source table, but to find the maximum length of the data in this column to see if it is used as varchar (100) or if it has only the length of data of 50 for example.

Any ideas would be appreciated.

Hi Srikkanth

It should be the reverse - find the length, not the length of the maximum value. Maximum based its value on the fate of the ascii, not the length...

CREATE TABLE dt_TEST
(text VARCHAR2(100))
/
INSERT INTO dt_test VALUES('AA')
/
INSERT INTO dt_test VALUES('z')
/
SELECT LENGTH(MAX(text)),max(length(text)) FROM dt_test
/

HTH

David

Tags: Database

Similar Questions

  • How to get the column number

    Hi all,

    I'm sorry to ask this question because I found 2 different answers, tried without result. So before you go crazy, I prefer to ask!

    Thus given mySelection = app.selection [0], how is possible to get the column's selection?

    I tried app.selection [0] .parentTextFrames [0].characters.itemByRange (0, x)

    with x being app.selection [0] .index.

    but then I'm stuck as if I add ".textColumns", I get an error

    I explored the second way using app.selection [0].textColumns.item (1).insertionPoints.item (1), but once I'm stuck again.

    As a beginner I don't understand why there is no simple built-in function to call in order to obtain such a result of base

    Any help would be appreciated

    Thank you

    Ed

    Okay here goes,

    For and only for the linked text frames.

    // For and only for linked text frames.
    // Warning
    // The Good: This will PROBABLY work for you
    // The Bad :THIS IS A REALLY PRIMITIVE METHOD
    // The Ugly: It could fail in COUNTLESS cases
    // Here goes......
    
    var mySelection, textFrame, parentPage, c;
    mySelection = app.selection[0];
    textFrame = mySelection.parentTextFrames[0];
    parentPage = textFrame.parentPage;
    c = 0;
    while(textFrame && textFrame.parentPage === parentPage){
        textFrame = textFrame.previousTextFrame;
        c++;
    }
    
    alert('Column number: ' + c);
    

    Now with regard to the issue of the image columns bound text compared to the blocks of text with multiple columns of text or span. Depends on what you're trying to achieve with your workflow.

    The scripts are around written by me and others who convert multicolumn text executives to related texts related and vice versa.

    If you want to know which is more appropriate you can use with your workflow, then I suggest the regular ID forum.

    HTH

    Trevor

  • How to get the column provided out of the Oracle Data Miner?

    Hi all!

    I use Oracle Data Miner provided with Oracle SQL Developer to predict the loss of customers. If I plan on the table column lets say X (as a target column) of table say T, so how can I get the corresponding values under my model?

    Here is the simplified model for the reference.

    Thanks in advance!

    Customer churn.PNG

    Hello

    Simply connect a node that accepts data to the node to apply it.

    For example, if you want to create a view or table table using the prediction of outputs generated by the node to apply it, and then add a Create Table node and connect the node to apply it.

    For more information, try the Oracle by example tutorials for ODMr.

    You must use the node apply Publisher to revise prediction outputs models to generate as well as the additional columns to include, for example columns id.

    There are a set of predictor columns added by default that may be acceptable.

    THX, mark

  • How to get the column headers into an Excel report with variable width columns?

    Hello:

    I read this question before but I can´t open the link when I try to download the solution I get the following: status HTTP 404 the requested resource is not available.

    Can someone help me with the solution? I want to just put a heading for each column (1 thermocouple, thermocouple 2, anemometer, etc.).

    In advance, thank you for your help!

    You may need to take some tutorials.

    LabVIEW Introduction course - 3 hours
    LabVIEW Introduction course - 6 hours

  • Get the columns returned by the query without running

    I have a table that stores SELECT queries in a column. I developed a .net application where the interesting thing for the user is what columns of the following SELECT statement returns. Currently, I load the sql as an OracleCommand object CommandText and fill a DataTable using an OracleDataAdapter object. I then read the names of the columns of the table filled. The data is not fully used. Requests can take up to 15 seconds to run. Because I do not used the data, I was hoping to eliminate the actual recovery of data and reduce the time needed to retrieve the records. Is it possible to analyze the statement for the colunm names with it makes the request for enforcement? Thank you.

    I imagine that there is a way you can search in the data dictionary, but you can also try to add 'WHERE 1 = 0' If you want the metadata.

    It will be useful,
    Greg

  • [ADF, JDev12.1.3] How to get the column headers, request of VO and VO bind vars used by an af:table?

    Hallo,

    I want to create a method that takes as a parameter the id of an af:table (used to display the search results) and returns:

    • the column headings of the af: table
    • Visible property (true/false) of the columns af:table
    • the actual query of the VO instance used to create the af: table
    • the values of real bind variables passed to the query of the instance of VO

    I would like to create a servlet which takes the parameters reruns the query and returns a report Excel/PDF file that contains exactly the same columns and same of the af records: table.

    I'm a little confused on who use the code to achieve this... you kindly help me?

    I did a similar qustion here Re: [ADF, JDev12.1.3] how to export an af:table to Excel in an ADF Essentials application? but then I guessed that it was preferable to create a new thread.

    Thank you

    Federico

    For this, you can use this type of code

    Context LocaleContext = _adfTableBinding.getLocaleContext ();

    for (attr AttributeDef: attributeDef) {}

    Label As String = attr.getUIHelper () .getLabel (context);

    _logger.info ("Attritbute name:" + attr.getName () + "column name:" + attr.getColumnName () + "Col4Query name:" + attr.getColumnNameForQuery () +)

    "Name:"+ label);

    }

    which produces this output

    Timo

  • How can I get the columns-by-side?

    http://www.Adobe.com/devnet/Dreamweaver/articles/first_website_pt2_08.html

    In the creation of your first tutorial of Web site (see link) I can not understand how to recover the columns side by side are being stacked. I went on the indications of the tutorial at least five times. What I am doing wrong in coding?   Here is a picture of my screen:Dreamweaver.jpg

    Here is a screenshot of how the columns should be stacked (from the tutorial):

    Dreamweaver-1.jpg

    Take a look at where you graduate #center_column in the html code of the page. You have this:

    where it should be

    Because a class called 'center_column' has not been defined (somehow), it belongs to the following line.

    I saw your styles for all three columns, as IDs.

    Beth

  • Select the lines with the maximum value for a date where another column is different from 0

    Hello

    I need to write a query on a table (called DEPRECIATION) that returns only the rows whose date maximum (PERENDDAT_0 column) for a specific record (identified by AASREF_0), and where the other column in the table called DPRBAS_0 is different from 0.

    If DPRBAS_0 is equal to 0 in all the lines of a specific record, then return the line with date maximum (PERENDDAT_0 column).

    To be clearer, I give the following example:

    Suppose we have the following data in the table of DEPRECIATION:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001074331/12/20140
    I2011001074331/12/20130
    I2011001085612/31/20160
    I2011001085631/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445
    I2014001223831/12/2015445
    I2014001223831/12/20140

    The query must return only the following lines:

    AASREF_0 PERENDDAT_0 DPRBAS_0
    I2011001074331/12/20150
    I2011001085631/12/2014332
    I2014001223812/31/2016445

    Thanks a lot for your help!

    This message was edited by: egk

    Hello Egk,

    The following query works for you.

    SELECT AASREF_0, PERENDDAT_0, DPRBAS_0

    FROM (SELECT AASREF_0,

    PERENDDAT_0,

    DPRBAS_0,

    ROW_NUMBER)

    DURING)

    AASREF_0 PARTITION

    ORDER BY

    CASE WHEN DPRBAS_0 <> 0 THEN 1 OTHER 0 END DESC,.

    PERENDDAT_0 DESC)

    RN

    DEPRECIATIONS)

    WHERE rn = 1

  • How to get the columns of the table based on different conditions in one column?

    Hello

    I have two sql queries-

    Select sum (col1) sum1 Tab1
    where join_date > (sysdate - 1).

    Select sum (col1) sum2 of Tab1
    where join_date > (sysdate-4)

    I need to use a single query to get sum1 and sum2 data in a single line.


    Can someone help please how?

    Like this?
    
    select sum(case when join_date > (sysdate - 1) then col1 else null end) sum1
         , sum(col1) sum2
      from tab1
     where join_date > (sysdate - 4)
    
  • How to get the column and the row of winding of title in a custom section?

    In default, the title of column and line's not winding print when the specification in the Chinese environment.

    How to make them winding?

    Thank you

    Please change ExtendedAttributes$ xlate$ .xsl EASectionTable section of the file in the folder/reports/FO as below:

  • Get the column names with cursor or an alternative

    Hi guys,.

    What I currently have is an email with an attachment from PL/SQL. I need to display the query results in .txt attachment. What I've done now is to use a slider but it shows only the results I want column names & ideally the message "14 rows returned. How could I put this in a VARCHAR2?

    Mike

    Add a value to each sub selection order by...

    for example

    SQL> set heading off
    SQL> ed
    Wrote file afiedt.buf
    
      1  select colA, colB, colC
      2  from (
      3        select 1 as ord, cast('TABLE_NAME' as char(30)) colA,cast('GRANTEE' as char(30)) colB,cast('PRIVILEGE' as char(30)) colC from dual
      4        union all
      5        SELECT 2, rpad('-',30, '--') colA, rpad('-',30, '--') colB, rpad('-',30, '--') colC from dual
      6        union all
      7        select 3, cast(table_name as char(30)) colA,cast(grantee as char(30)) colB,cast(privilege as char(30)) colC from user_tab_privs where table_name like 'EMP'
      8       )
      9* order by ord, colA
    SQL> /
    
    TABLE_NAME                     GRANTEE                        PRIVILEGE
    ------------------------------ ------------------------------ ------------------------------
    EMP                            SCOTT                          SELECT
    
    SQL>
    
  • GET THE HTTP REQUEST PARAMETERS

    Hello

    How can I send three parameters through GET on my server, I need to send three sttrings generated in my application on the server.

    I've tried with network application of Pentecost without success, demand will, but parameters never arrive

    QNetworkAccessManager * Manager = new QNetworkAccessManager (this);
    Application of QNetworkRequest (QUrl ("http://server.php"));
    request.setRawHeader ("to", "email");
    request.setRawHeader ("title", "hello");
    request.setRawHeader ("msg", "text messages");

    Manager-> get (request);

    Thank you

    You could add the strings as GET parameters to the URL:

    QUrl ("http://server.php?to=email&title=hello&msg=text+msg");

    But I think you should PUT these fields to the server because the URL has a maximum length:

    QByteArray data;

    Data.Append ("[email protected] &"); ")

    Data.Append ("title = Hello World &"); ")

    Data.Append ("msg = Hello World! Are you okay? ») ;

    Manager-> post (request, data);

    I have it wrapped in a method that takes QMap as parameter and returns QByteArray, because it's quite annoying to keep in mind to add '&' between each pair of key / value.

  • Add/change the columns of data type (scripting)

    Hello

    I am writing a script to add default columns and their values in tables. So far, for me, it is possible to add columns to an existing table in the model.

    Then, I want to add value to the data type. I discovered there is a method called getDataType(). So far, I have not found the "setter; for this property.

    Like other scripts, I started by creating a table with columns, and then using the API to read the values.

    A simplified version of my code:

    get the columns of table

    myTab var = model.getTableSet () .getByName ("T_POSITIONS");

    colArray = myTab.getElementsCollection () .toArray ();

    loop through columns

    for (i = 0; i < colArray.length; i ++) {}

    the type of var data = colArray [i] .getDataType ();

    model.getAppView () .log (colArray [i] + "a datatype" + dataType);

    colArray [i] .setDataType ("VARCHAR2 (1)");

    }

    An error occurs when I want to run this script: could not find setDataType function in the object ID.

    I can't find the right method to add/change the datatype property.

    Any information would be appreciated.

    Hi Bart,.

    Here's what's in the column in the XML file:

    
    FDB11R21
    EMPLOYEES
    FIRST_NAME
    
    2015-01-13 12:45:08 UTC
    First name of the employee. A not null column.
    HR_870
    true
    false
    1
    LOGDT024
    20 BYTE
    false
    
    

    20 BYTES

    If you need set the size in "20 BYTE" or "20 CHAR".

    Philippe

  • To get the name of the table the column

    Hi I have an Html5 app, and I get the dataset from the database and bind the data based on the column name. but the answer of the oracle db column names as attr_1, attr_2 and so on. Here is the code and the result after execution.

    create or replace PACKAGE SAYAM
    IS
           CURSOR cur
           IS
                  SELECT CAST(0 AS NUMBER(5, 0)) "COMPID" ,
                         CAST(0 AS NUMBER(4, 0)) "FINYEARID" ,
                         EMPLOYEEID,
                         CAST(0 AS NUMBER(5, 0))"MENUID" ,
                         CAST('' AS NVARCHAR2(10))"CALLBYPANEL",
                         EmployeeName
                  FROM  EmployeeInfo;
                 
    Type cur_tbl
    IS
           TABLE OF cur%rowtype;
          
    END SAYAM;
    
    

    DECLARE
           v_GlobalParam Xmltype:=Xmltype(
           '<QueryParam> 
    <CompID>1</CompID> 
    <FinYearID>1</FinYearID> 
    <MenuID>0</MenuID> 
    <EmployeeID>-1</EmployeeID> 
    <CallByPanel>APPWEB</CallByPanel>
    <EmployeeName>Ranjit</EmployeeName>
    </QueryParam>'
           );
           tableglobal SAYAM.cur_tbl;
           rc sys_refcursor;
    BEGIN
           SELECT XT.CompID,
                  XT.FinYearID,
                  XT.MenuID,
                  XT.EmployeeID,
                  XT.CallByPanel,
                  XT.EmployeName bulk collect
           INTO   tableglobal
           FROM   XMLTABLE('/QueryParam' PASSING v_GlobalParam COLUMNS
                  CompID NUMBER(5) PATH 'CompID' ,
                  FinYearID NUMBER(4) PATH 'FinYearID' ,
                  MenuID NUMBER(5) PATH 'MenuID' ,
                  EmployeeID NUMBER(5) PATH 'EmployeeID' ,
                  CallByPanel VARCHAR2(10) PATH 'CallByPanel',
                  EmployeeName Varchar2(200) Path 'EmployeeName' ) XT;
           OPEN rc FOR SELECT * FROM TABLE(tableglobal);
           SYS.DBMS_SQL.RETURN_RESULT(rc);
    END;
    
    
    

    Now, I get the below result-

    Capture.PNG

    but the goal that is required is as below with the valid column name

    Capture.PNG

    Please let me know if there is any action to get the column names.

    Thanks in advance.

    Apologies - I have managed to reproduce the original problem in 12.1.0.2.

    The problem with ATTR column names is that you use a local collection declared in a package.

    You need a SQL type.

    But does not change my position when it comes to a sensible direction to go.

    SQL> l
      1  create or replace type sayam_obj as object
      2  (compid      number(5,0)
      3  ,finyearid    number(4,0)
      4  ,employeeid  number
      5  ,menuid      number(5,0)
      6  ,callbypanel  nvarchar2(10)
      7* ,employeename varchar2(100));
    SQL> /
    
    Type created.
    
    SQL> create or replace type sayam_tbl as table of sayam_obj;
      2  /
    
    Type created.
    
    SQL> get test3.sql
      1    DECLARE
      2        v_GlobalParam Xmltype:=Xmltype(
      3        '
      4    1
      5    1
      6    0
      7    -1
      8    APPWEB
      9    Ranjit
    10    '
    11        );
    12        tableglobal sayam_tbl := sayam_tbl();
    13        rc sys_refcursor;
    14    BEGIN
    15        SELECT sayam_obj(XT.CompID,
    16              XT.FinYearID,
    17              XT.MenuID,
    18              XT.EmployeeID,
    19              XT.CallByPanel,
    20              XT.EmployeeName) bulk collect
    21        INTO  tableglobal
    22        FROM  XMLTABLE('/QueryParam' PASSING v_GlobalParam COLUMNS
    23              CompID NUMBER(5) PATH 'CompID' ,
    24              FinYearID NUMBER(4) PATH 'FinYearID' ,
    25              MenuID NUMBER(5) PATH 'MenuID' ,
    26              EmployeeID NUMBER(5) PATH 'EmployeeID' ,
    27              CallByPanel VARCHAR2(10) PATH 'CallByPanel',
    28              EmployeeName Varchar2(200) Path 'EmployeeName' ) XT;
    29        OPEN rc FOR SELECT * FROM TABLE(tableglobal);
    30        SYS.DBMS_SQL.RETURN_RESULT(rc);
    31*    END;
    SQL> @test3.sql
    
    PL/SQL procedure successfully completed.
    
    ResultSet #1
    
        COMPID  FINYEARID EMPLOYEEID    MENUID CALLBYPANE
    ---------- ---------- ---------- ---------- ----------
    EMPLOYEENAME
    --------------------------------------------------------------------------------
        1        1          0    -1 APPWEB
    Ranjit
    
  • How to get the value of a particular column column name?

    Hi all

    How to get the column name for a particular column value.
    example:

    create table test (ID number, col2, col3 varchar varchar);

    Insert into test values (1, 'true', 'false');
    Insert into test values (2, 'false', 'true');
    commit;

    I want to choose the name of the data column 'true' with id = 1;

    That is to say) while waiting for answer is "col2". pls help someone.

    This might help:

    DECLARE
       c1 SYS_REFCURSOR;
    BEGIN
       OPEN c1 FOR
       SELECT col2,
              col3
       FROM   test
       WHERE  id = 1;
       --
       FOR c IN (SELECT rownum rn,
                        t2.column_value.getrootelement() name,
                        EXTRACTVALUE(t2.column_value, 'node()') value
                   FROM TABLE(XMLSEQUENCE(c1)) t,
                        TABLE(XMLSEQUENCE(EXTRACT(column_value, '/ROW/node()'))) t2)
       LOOP
          IF c.value = 'true' THEN
             DBMS_OUTPUT.PUT_LINE(c.name);
          END IF;
       END LOOP;
    END;
    

Maybe you are looking for