convert long varchar

Hi all. Why I get this error? :_|

create or replace function mike.getHighValue)
p_owner varchar2,
p_table varchar2,
p_part_name varchar2
) return varchar2 as

l_data long;

Start
Select high_value from dba_tab_partitions l_data
where table_owner = p_owner
and table_name = p_table
and nom_partition = p_part_name;
Return substr (l_data, 1, 4000);
end;

------

Select mike.getHighValue (high_value) from dba_tab_partitions;


ORA-00997: illegal use of the LONG data type

When you select ' select mike.getHighValue (high_value) from dba_tab_partitions;

you do not pass the correct values, you need to select as follows:

Select mike.getHighValue ('SH', 'SALES', 'SALES_1995') in the dba_tab_partitions';

Tags: Database

Similar Questions

  • convert long varchar use views

    I want to get varchar2 column search_condition (dba_constraints), but get an error:

    Select constraint_type, table_name, getSerCon (rowid)
    of dba_constraints


    ORA-01445: cannot select ROWID, or sample, join without table views preserved key



    create or replace function getSerCon)
    p_rowid in rowid) return varchar2 as


    l_data long;

    Start
    Select condition_de_recherche from l_data dba_constraints where rowid = p_rowid;
    Return substr (l_data, 1, 4000);
    end;


    Can not you advide me how to convert.

    DBA_CONSTRAINTS is a view based on many SYS belonging to tables. So there is no own ROWID. This is why your code does not work. Now the combination of the owner, table_name, constraint_name is unique, so that you can change the function to use instead. Also, search this forum for other solutions with long

    SY.

  • Long Varchar conversion?

    OK, so I'm trying to analyze the source code of compiled views. so I'm going with a simple:

    long value 1000000

    Select the text in dba_views where view_name = "DBA_VIEWS;

    I use DBA_VIEWS just to keep the results to short, because everyone has it... and it's mildly amusing to choose from to

    In reality, I will have a wider where clause.

    So, now I want to search the text for some references, diagrams and tables. So let's just look at "sys."

    Select text

    from dba_views

    where view_name = "DBA_VIEWS.

    and instr (text, 'sys') > 0;

    ERROR on line 4:

    ORA-00932: inconsistent data types: expected NUMBER got LONG

    Large.

    OK, so I'm doing a research to try to understand to get 'convert' a long varchar and each solution according to me, is to 'migration' of the data. In other words, it assumes that you have created your own TABLE with a LONG data type, and the need to MOVE in another TABLE. Which is not even close to what I'm doing here. I question the fair data.

    Then I come across this little gem:

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:839298816582

    Candy!

    So I give that a try:

    (I've renamed its function, but has not changed any other logic, or another change of name).

    FUNCTION to CREATE or REPLACE f_long_to_varchar

    (p_tname IN VARCHAR2,

    p_cname IN VARCHAR2,

    p_rowid IN ROWID

    )

    RETURN VARCHAR2

    AS

    l_cursor INTEGER default dbms_sql.open_cursor;

    l_n NUMBER;

    l_long_val VARCHAR2 (4000);

    l_long_len NUMBER;

    l_buflen NUMBER: = 4000;

    l_curpos NUMBER: = 0;

    BEGIN

    DBMS_SQL. Parse (l_cursor,

    "SELECT" | p_cname | 'FROM ' | p_tname |

    ' WHERE rowid =: x',.

    DBMS_SQL.native);

    DBMS_SQL.bind_variable (l_cursor, ': x', p_rowid);

    DBMS_SQL.define_column_long (l_cursor, 1);

    l_n: = dbms_sql.execute (l_cursor);

    IF (dbms_sql.fetch_rows (l_cursor) > 0) THEN

    DBMS_SQL.column_value_long (l_cursor, 1, l_buflen, l_curpos,)

    (l_long_val, l_long_len);

    END IF;

    DBMS_SQL.close_cursor (dbms_sql.open_cursor);

    RETURN l_long_val;

    END f_long_to_varchar;

    /

    Select f_long_to_varchar (text) in the dba_views where view_name = "DBA_VIEWS;

    ERROR on line 1:

    ORA-00997: illegal use of the LONG data type

    Large. So, does anyone have other ideas?

    How can I query the dba_views and sweep the text as a varchar field?

    Can it be done without moving the data to a temp table? Or the other case - how to do?

    I'm coming up absolutely empty on that.

    Thank you!

    Without creating additional objects, you can try the following query. It supports the content of greater than 32 KB size.

    However, it is quite slow.

    Select v.owner

    v.view_name

    x.text

    from dba_views v

    , xmltable ('/ LINES/LINES/VIEW_T ')

    passage (document xmlparse

    () DBMS_METADATA.get_XML

    schema-online v.owner

    , object_type-online "VIEW".

    name-online v.view_name

    )

    correct

    )

    path of clob columns text "TEXT".

    ) x

    where instr (x.text, 'QA') > 0

    - and v.view_name = 'DBA_STREAMS_COLUMNS. '

    ;

  • Convert long DDMMYY

    Hello

    I am getting server date string in todays date DDMMYY format e.g. is 180811. I want to convert long. I used HttpDateParser, but it does support this format. How can we achieve this?

    Thank you

    @simon_hain: thank you. Now it works very well...

    String PROMOTIONDate = "20";
    Nouvelle_date = Nouvelle_date + date.substring (4, 6) + "-" + date.substring (2, 4) + "-" + date.substring (0, 2);

    but I'm not loving the manual scan.

  • ODI - in collaboration with Long Varchar and CLOB

    Hi all

    I have a source table 'A' that contains a column of type LONG VARCHAR, I need to map to a CLOB column in the table target 'B '. The column can be mapped just without any type of 'distribution' of the LONG VARCHAR in the CLOB column?

    Thanks in advance

    Eduardo

    Even I don't think that you need the TO_CHAR.

    On what task it block in operator? What is the code generated for this task?

    Kind regards

    JeromeFr

  • convert long raw to blob

    Hello
    I'm migration 8i to 11 GR 2 using exp/imp
    I have tables with Long Raw columns

    an easy way to convert them to blob, because currently they are created as Long Raw?

    Thank you

    Hello

    Tom described it on his site: http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:13213885403654
    If you google, you will find many other examples.

    If you have the choice to do in 8i or 11 GR 2.

    Herald tiomela
    http://htendam.WordPress.com

  • procedure for converting long on the clob type

    Please you need to process long migrate on the clob, with variables type
    V_SRC_TABLE (LONG) to V_TRAGT_TABLE (CLOB)

    SOURCE AND TARGET HAVE TWO COLUMNS

    SOURCE_TABLE
    VARACHAR2
    LONG


    TARGET_TABLE
    VARACHAR2
    CLOB

    Hello

    Assuming you want to convert data always source_table target_table knowing the column names, let's say:

    SQL> CREATE TABLE source_table(col1 VARCHAR2(10), col2 LONG);
    
    Table created.
    
    SQL> CREATE TABLE target_table(col1 VARCHAR2(10), col2 CLOB);
    
    Table created.
    

    You can simply copy the data using SQL:

    INSERT INTO target_table SELECT col1, TO_LOB(col2) FROM source_table;
    

    Or, as a procedure:

    CREATE OR REPLACE PROCEDURE migrate_to_clob IS
    
    BEGIN
    
      EXECUTE IMMEDIATE 'INSERT INTO target_table SELECT col1, TO_LOB(col2) FROM source_table';
    
    END;
    

    It will be useful.

  • CONVERT varchar into money

    Can someone help me with the syntax on how convert data type varchar data type money. I get the following error message:

    [Macromedia] [SQLServer JDBC Driver] [SQL Server] Denied the implicit conversion of the data type varchar data type money, table 'tableName', column 'columnName '. Use the CONVERT function to run this query.

    Any help would be appreciated! Thank you.
    SLL

    The error is caused by the use of single quotes around #form.price #. Single quotes tell sql server to deal with the #form.price # as a string (varchar) value. Although sql server can implicitly convert some values from one data type to another is not automatically converted to varchar in type money.

    Assuming that you have already validated the value #form.price #, get rid of the apostrophes or better to use cfqueryparam with the proper cfsqltype. (I think that's cf_sql_decimal)

    -It works
    Update @tblName
    fixed price = 10.00
    where id = 1

    -It works
    Update @tblName
    fixed price = cast (' 10.00 ' as money)
    where id = 1

    -It's not
    Update @tblName
    fixed price = '10 h 00'
    where id = 1

    -using the cfqueryparam
    Update @tblName
    package price =
    where id = 1

  • How to convert varchar to date datatype all insert or update in the table

    Hai All

    I need to convert to varchar type to date.

    I have two Tables T1, T2

    Structure of T1

    Code varchar

    Time varchar

    Date varchar

    Structure of T2

    Var EmpName

    Empcode var

    Date of the respondent

    Outtime date

    Intrinsically date

    Date of Introut

    Att_date

    Now I need to spend the time form T1 to T2 respondent, outtime, intrinsically, introut under certain conditions

    So now I need to convert Varchar to Date so that the insert or update

    I tried something

    Insert into T1 (code, respondent, att_date) values

    (To_date(Date|| dele de code temps, «hh24mi de mon-dd-yyyy»), att_date);

    OR update while

    Setting a day set Outtime T2 = To_date(Date||) Time, 'hh24mi mon-dd-yyyy') where...


    I got an error Ora-01861


    Concerning

    Srikkanth.M

    You did not show an example of your date or time values, control may be necessary to add a space between them, like

    To_date(Date || ' ' || time,'dd-mon-yyyy hh24mi')
    
  • LONG - instr and grid... Select

    Hello

    Two queries:
    (a) how to search for a character/combination of characters in a column
    (b) how to perform a backup of a table that contains a LONG column (may contain other types of data such as the number, etc. varchar columns.)

    I tried to use INSTR and CREATE (INSERT)... SELECT the options, but both failed with errors.
    SQL> CREATE TABLE T1(C1 LONG);
     
    Table created
     
    SQL> INSERT INTO T1 VALUES (';Z00:101CGEZZP1904300M5');
     
    1 row inserted
     
    SQL> SELECT INSTR(C1,'ZP') FROM T1;
     
    SELECT INSTR(C1,'ZP') FROM T1
     
    ORA-00932: inconsistent datatypes: expected NUMBER got LONG
     
    SQL> CREATE TABLE T2 AS SELECT * FROM T1;
     
    CREATE TABLE T2 AS SELECT * FROM T1
     
    ORA-00997: illegal use of LONG datatype
     
    SQL> 

    Hello

    LONG is an old format with a lot of limitations that will make your life miserable. If you need to copy your table to another, take this opportunity to convert long on the CLOB type using the to_lob() function.

     create table t1(id long);
    
     create table t2 (id clob);
    
     insert into t2 (id) select to_lob(id) from t1;
    

    Best regards
    Nikolai

  • Why is there a long column in user_tab_partition?

    Hi all

    While I was working on a project of partitions, I realize that I had to work with long files.

    It turns out I realized that it was quite obsolete:

    Convert long to varchar2 or clob pure Oracle SQL

    Conversion from long to varchar2

    "Why do you have a column of LONG data type?

    LONG data type has been deprecated since CLOB were introduced about 10 years ago. Oracle does not recommend you use LONG data type and it is there than to support backward compatibility. »

    Not all wrong, by the data dictionary seems full of craft:

    http://docs.Oracle.com/CD/B14117_01/server.101/b10755/statviews_1058.htm

    So I wonder, because the effort is given to discourage and de-motivate people from using LONG data types, why oracle is not refresh its data was thinking?

    Because I wanted to be to operate in this column (do a SHIFT to see the high value and low value of the previous score), I had huge problems to do.

    How could have out us of Oracle on the topic?

    Not being don't not an Oracle database designer, I can't speak for Oracle, but I see that the user_tab_partitions of view and it relies on the base tables have been designed well before that Oracle introduced the LOB data type.  Change the data type of a database table, we hear all code that refers to this column must be updated.  New SYS objects use LOBS, but most of the time Oracle has not returned and modified existing objects.  Maybe in version 20 (i.e. at some point remote in time).

    - -

    IMHO - Mark D Powell-

    PS - A change to a base table data type would be also means existing data on the upgrade will need to be converted.  Potentially existing a requirement of your time which is another reason to not change the data type.

  • How to insert the value of a LONG data type?

    Hi all

    Developers what to change the type of data in the PRODUCTS table.

    PRODUCT
    ======
    ID number (10) not null,
    NAME varchar2 (50) not null,
    DESCR varchar2 (250) not null


    They want the DESCR to change datataype at LENGTH

    So I got back it up first:

    create the table product_bak in select * from product;
    remove the product;
    change the product table change (descr, null);
    Edit the product table change (long descr);
    Insert into select product * from product_bak;

    ORA - 997 - illegal use of LONG data type


    How can I recover my data?


    Thank you very much.

    Use TO_LOB to convert long on the CLOB type, then use TO_CHAR to convert CLOB VARCHAR2.

  • Query a date in a varchar field

    I'm doing a simple query...

    Count the number of records in a given month.

    I use variables in the URL and use this query (MSSQL)


    SELECT recorddate FROM sometable
    WHERE Year (recorddate) AS ' #Url.year # '.
    AND Month (recorddate) AS ' #Url.month # '.

    It should work in theory, I think, but the problem is that the date field is of type varchar (although all records have a time stamp that has been added as:)

    < INPUT type = "hidden" name = "recordate" value = "#Now () #" >

    I'm not advanced in ColdFusion, so I hope someone can help me... Is there a simple way to do this?

    Thank you!

    I agree with Dan Bracuk you need to store your date values in a date column.  It would be for SQL server DATETIME, SMALLDATETIME, or DATE depending on your version of the server and the requirements.

    As a quick fix, you can use a derived table that converts your varchar in date column values.  Note that this must be used as a work around until you can update your table to use a date column.  This request will probably not run well on large data sets.  You must also use the CFQUERYPARAM tag to avoid SQL injection vulnerabilities.

    
    
        SELECT recorddate
         FROM
         (
             SELECT CONVERT(DATETIME, recorddate) AS recorddate
             FROM sometable
         ) AS Q
         WHERE Year(recorddate) = 
             AND Month(recorddate) =    
    
    
    
  • How to convert a timestamp in tank

    Hai all

    How to convert a timestamp to varchar

    I had a query called Cube_instance

    Here, the creation date is declared as timestamp. This is my request

    Select count (1) in the cube_instance where ID_processus like 'PreAdviceHandler %' and
    CREATION_DATE between July 30, 10 00.00.00.000000' and
    31 JULY 10 00.00.00.000000';

    My result is when I run this query, I need the count starts from 30 declaring Jul and 30 jul ending when I run the present 31 Jul


    How to convert this varchar timestamp and give the condition


    Kind regards

    Srikkanth.M

    Published by: Srikkanth.M on July 31, 2010 01:53
    select count (1)
    from cube_instance
    where process_id like 'PreAdviceHandler%'
       and creation_date between trunc (sysdate) and trunc (sysdate + 1) - interval '1' second;
    
  • varchar secret number

    Hello


    IM using independent discoverer 10.1.0.2, i need to convert the varchar value in number in order to perform a calculation, else an error occurs error.but datatype, I have no idea how to do the conversion in number.please any idea

    Thank you

    kind regard

    PL has use the sql TO_NUMBER function

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/functions191.htm#i79512

    HTH
    Srini

Maybe you are looking for

  • Tecra S5: Which driver Lan Wireless necessary

    Hello I have an S5 and receive information from a wireless Lan driver. Excellent service. But what is used? I follow the link for downloads and offers me different drivers. So I try to establish that you choose and that's where my problem begins. On

  • Is there a Toshiba Power Saver for Vista?

    I can't find a version of POWER SAVER for vista. This is only for XP?

  • bypass tray 8600 (no)?

    Our printers earlier, when a separate legal tray, having not had a "bypass" on the back of the printer accepted the vertical stacking of a small number of pages. In this way, you can keep legal in the area of "Workaround" while having the letter in t

  • Multiple by cycles

    Ladies and gentlemen, could you be so kind and help me? I have this "simple" script To display all extensions on internal disks, but it does not work. It seems that %Disk%:\ or % disc position must be constant, not variable pitch. Or something else i

  • remove objects and events

    Hello If I do a removeChild on a button, did remove the EventListener or what I have to do this first? Harry