Sql Query - Insert Concatenation String To Table?

Aug 6, 2012

i try to insert Concatenation string to my table,i need that all traps that has 12 length will be insert the new trapnum like this:

for example: 26001005CC45 = 260001005CC0045 ....... 08060027RF05 = 080600027RF0005 ......... and so....

update trap set TrapNum = (
select trim(both from to_char(substr(TrapNum,1,4),'0000'))||
trim(both from to_char(substr(TrapNum,5,1),'00'))||
trim(both from to_char(substr(TrapNum,6,3),'000'))||
substr(TrapNum,9,2)||
trim(both from to_char(substr(TrapNum,11,2),'0000')) from Trap)
where length(Trapnum)=12

but i got error ORA-01427

View 1 Replies


ADVERTISEMENT

PL/SQL :: How To Do String Concatenation

Nov 22, 2012

I am trying
  
IF LENGTH(v_final_string) < 3800 THEN
        SELECT nvl2(v_final_string,v_final_string
          ||',' ,v_final_string)
          || temp.temp_string
        INTO v_final_string
        FROM DUAL;
        DBMS_OUTPUT.put_line ('v_final_string=' || v_final_string );
      ELSE
        EXIT;
      END IF;inside a loop.

But it's not concatenating. I am alwas getting empty v_final_string

View 9 Replies View Related

PL/SQL :: Result String Concatenation

Jul 11, 2012

I am trying to spool the data to a file , and my query has 115 columns and out of which 20 columns have varchar2(2000). And its throwing result string concatenation too long.

I tried using to_clob function , but spool file does not show the complete result set.

View 4 Replies View Related

Result Of String Concatenation Is Too Long

Jan 4, 2008

I am receiving a ORA-01489: result of string concatenation is too long error on the following code. The size of the MNO_NOTE fields is: MNO_NOTES_1 X(2000). I'd rather not modify the DB table column size, but rather that capacity of the "notes", or whatever structure the concatenated string is stored in. Could I use the substring method?

SELECT TO_DATE(TO_CHAR(mno_date_recorded,'yyyymmdd')||
TO_CHAR(mno_time_recorded,'0009'),'yyyymmddhh24mi')
AS create_date,
stf_id AS create_user,
RTRIM(MNO_NOTES_1)||
RTRIM(MNO_NOTES_2)||
RTRIM(MNO_NOTES_3)||
RTRIM(MNO_NOTES_4)||
RTRIM(MNO_NOTES_5)||
[code]...

View 1 Replies View Related

ORA-01489 - Result Of String Concatenation Is Too Long

Jul 25, 2012

I have a sql query which has around 115 columns and out of which 25 columns are of varchar2(2000) and when I run the query I get the ORA-01489: result of string concatenation is too long error.

I tried to use to_clob function for the columns having varchar2(2000) and if I run the sql from toad , it works fine, but when I tried to run the same query from sqlplus and spool to a file, the result doesn't come in a single line. I have tried to import the spool file to my local and open it , but still it doesn't come in a single line, the data is trucated This is how my data looks in the spool file.

1-L31OGM|Red|1|Due|Qualified|02/08/2012||02/08/2012| you are missing a message.

These are the below set options used in the query . I even tried set long 100000000 and also set longchucksize option also, I have tried with WRAP OFF and WRAP ON also ,but still it doesn't work.

SET HEADING OFF
SET WRAP OFF
SET LINESIZE 32000
SET FEEDBACK OFF
SET PAGESIZE 0
SET LONG 32000
SET TRIMSPOOL ON
SET ECHO OFF
SET TERMOUT OFF

get the data in a single line and using utl_file package is not an option in our project due to security reason.

View 4 Replies View Related

SQL & PL/SQL :: ORA-01489 - Result Of String Concatenation Is Too Long

Aug 8, 2011

my rdbms, os version

SYS@prod> select PLATFORM_ID, PLATFORM_NAME from v$database;
PLATFORM_ID
-----------
PLATFORM_NAME
-------------------------------------------------------------------------
12
Microsoft Windows x86 64-bit
[code]...

as I googled the solution does not seems to apply to my case.it very puzzling that such a short query can produce

ORA-01489: result of string concatenation is too long.

View 3 Replies View Related

ORA-01489 / Result Of String Concatenation Is Too Long

Jul 30, 2013

when i run the interrogation bellow :

SELECT 'Existing Tables: ' || LISTAGG(table_name, ',') WITHIN GROUP (ORDER BY table_name) tablenames FROM user_tables;

i receive the error :

ORA-01489: result of string concatenation is too long
01489. 00000 - "result of string concatenation is too long"
*Cause: String concatenation result is more than the maximum size.
*Action: Make sure that the result is less than the maximum size.

View 1 Replies View Related

SQL & PL/SQL :: ERROR At Line 1 - ORA-01489 - Result Of String Concatenation Is Too Long

Aug 13, 2013

I am getting below error when i try to update in my table

ERROR at line 1:
ORA-01489: result of string concatenation is too long

how to resolve this. Note :This is Update query not select query

View 2 Replies View Related

SQL & PL/SQL :: Insert Records Of One Table Into Another - Literal Does Not Match Format String

Sep 30, 2010

I'm trying to insert records of one table into another using the insert into table with select logic.

I'm trying to convert a two character value using CASE statement:

CASE REC_TYPE
WHEN '00' THEN to_number('0')
ELSE to_number('1')
END "REC_TYPE"

The target field is defined as number(1,0) and the source field is varchar2(2).

I keep getting an ORA-01861 literal does not match format string error.

View 10 Replies View Related

PL/SQL :: String Search Query In Any Columns / Table In Database?

Sep 4, 2012

I am trying to search a word which starts with 'FRA' in any columns and any tables.

I am unable to find what is generating a join datasets in the webservice from teh database as it is not apparent within the 100 tables.

I ahve looked into

Re: How to search in all rows and all columns?
Re: SQL Search Query?

but none of these queries is working out for me as I am a user with no tables on its own but rather a user quering other tables.I think its a tweak on which dat a dictionary I can view

select distinct substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from all_cons_columns,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || 'fra'
|| '%'')'
).extract ('ROWSET/ROW/*')
)
) t
order by "Table";

running teh above query got me thsi error:

ORA-19202: Error occurred in XML processing
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1
19202. 00000 - "Error occurred in XML processing%s"
*Cause:    An error occurred when processing the XML function
*Action:   Check the given error message and fix the appropriate problem

View 4 Replies View Related

SQL & PL/SQL :: Insert Into Table A With Select Query On B And C?

Mar 22, 2013

I have a table A on dev with definition as TAble A(address,name) and the same table on Prod is defined as Table A(name,address).

my question is Ihave one package in that am trying to insert into this table as follows:

INSERT INTO A
SELECT b.name name,
a.address address,

[Code]....

so the query works on Prod but fails on Dev because column order is different.

I have 2 solutions:

1. I can mention column names in insert line and modify the query but tomorro some body changes again the definition of table A I need to change the query, so do I have solution in oracle sql that can handle the column order without specifying the column names in insert line.

so tomorrow On prod column order and on Dev column order is different though my sql should successfully execute.

View 5 Replies View Related

Performance Tuning :: Insert Into Table Slows Down Query

Sep 23, 2010

When i run a script that does a select from a single table (table has 33521868 records)the query is executed in about .094 seconds. I use the exact same query to insert into a temporary table and the query takes 10 minutes and more.

What should I be doing to speed up this process. Also tried using hints and it does not speed up the insert.

View 3 Replies View Related

SQL & PL/SQL :: Insert Records From A Select Query Into Temporary Table?

Mar 21, 2013

We are trying insert records from a select query into temporary table, some of the records is missing in the temporary table. The select statement is having multiple joins and union all which it little complex query. In simple terms the script contains 2 part 1st Part Insert in to temporary table 2nd part Select query with multiple joins, inline sub queries, unions and group by classes and conditions Eg. If we execute select statement alone it returns some count for example => 60000 After inserting into the temp table, in temp table the count is around 42000 why is the difference?

It is simple bulk inserts... insert in to temp table select * from xxx. also, there is no commit in between. The problem is all the records populated by the select statement are not inserted in to temp table. some records are not inserted.

Also, we had some other observation. It only happens in its 2nd execution and not its first run. Hope there might be some cache problem Even, we also did not believe that. We are wondering. In TOAD, we tested however at times it happens. In application jar file, after "insert in to temp select * from xxx" we take the i. record count of temp table and ii. record count of "select * from xxx" separately but both doesn't match. Match only at 1st time.

View 16 Replies View Related

How To Use String Buffer Instead Of String Query

May 9, 2008

show an ex to use string buffer for select statemnt

View 1 Replies View Related

SQL & PL/SQL :: ORA-01400 - Cannot Insert NULL Into (string)

Jun 2, 2011

Oracle version 11.2.0
OS Linux

I have a table with no primary key constraints with some roles containing null value/duplicates. I then decided to alter the table to add composite primary key constraints on four columns (a, b, c, and d). I did this by using the same script that was used to create the original table but this time adding the not null constraints.

I then took and export of the original table. I now want to import the data to the newly created table but I am now getting the error: ORA-01400: cannot insert NULL into (string).

I will like to perform the import without NULL. Is there a parameter in impdp that I can use? I tried DATA_OPTIONS=SKIP_CONSTRAINT_ERRORS but it didn't work.

Beside options using impdp is there a way to do an insert statement like this insert into table a (select * from table) excluding NULL;?

Basically, I need to load the data into the newly created table without NULL.

View 3 Replies View Related

SQL & PL/SQL :: Insert Comma After 3rd Position In String Value?

Jul 29, 2013

I have to convert string 1234567 as 123,456,7 .

note 1234567 is a string.

View 6 Replies View Related

SQL & PL/SQL :: Insert String Having Two Double Quote?

Nov 10, 2010

i have table contains a column of var char type i want to insert a value

'1 mmTHICK GI SHEET 4' X 8' X 1MM THICH' in to the coulmn but m getting error

I tried set scan off but its not worrking for the below query.

ERROR at line 1:
ORA-00923: FROM keyword not found where expected

my query is
Insert into Inventory select
'N1280000015',
'1 mmTHICK GI SHEET 4''' X 8''' X 1MM THICH',

[code]....

View 8 Replies View Related

Oracle 11.2 - Insert String Text?

Oct 28, 2012

when i insert string text in hebrew i see ????????? how to fix it ?

work on Oracle 11.2 on Oracle Developer using my C# program

View 3 Replies View Related

SQL & PL/SQL :: Insert From Large String Into CLOB

Jun 7, 2012

I'm looking for a way to insert strings larger than 40.000 characters in a CLOB-field without geting the "ORA-01461: can bind a LONG value only for insert into a LONG column".

Something like this:

insert into MyClobTable(ID,Data) values ('101','A string containing more than 40000 characters...')

The problem is that a Java-application concatinates the string from a MSSQL-DB so I don't store the string in my oracle-DB. As far as I'm aware this means I can't chop my string in pieces and use declare to put the pieces in variables, right?

Below is an example I found but I don't think I can apply it on my case, correct?

SQL> CREATE TABLE myClob
2 (id NUMBER PRIMARY KEY,
3 clob_data CLOB);

Table created.

SQL>
SQL> INSERT INTO myClob VALUES (101,null);

1 row created.

SQL>
SQL> declare
2 clob_pointer CLOB;
3 v_buf VARCHAR2(1000);
4 Amount BINARY_INTEGER :=1000;

[Code]...

PL/SQL procedure successfully completed.

SQL>
SQL> drop table myClob;

Table dropped.

SQL>

View 3 Replies View Related

SQL & PL/SQL :: Insert Using String Matches / Matching And Searching Match

Jul 3, 2012

i have three tables ot_cut_head,ot_cut_det and om_mc_master based on which fourth table ot_cut_opr and fifth table ot_cut_mc must get populated , Conditions are as follows

first one is based on job_no in ot_cut_head the selection criteria will be filtered,if the job number is like '%M' then type MISC will be chosen ,if job number is '%G' then GRAT TYPE will be picked from om_mc_master (Machine Master) and operations and machines based on this will be filtered.

Second all the cd_ps_desc will be taken from ot_cut_det and will be compared with om_mc_master to get their corresponding operation codes and machine codes , there can be 2 operations or 1 operation.

Finally if the match is found record will be inserted into ot_cut_opr and ot_cut_mc ,based on the criterias and what i want is the search criteria to be more flexible and if there are 2 operations 2 rows will be inserted and if one opeation is defined in om_mc_master ,then only one record will be inserted.

We have to make sure that if based on operation number stage will be populated ,if its first operation then stage will be 1 and if its second operation the stage will be 2.like previous operation also depends on them , the second operation will have the previous operation as first operation and so on.

CREATE TABLE om_mc_master ( mc_type VARCHAR2(12),mc_prof VARCHAR2(30),mc_prep_cd1 VARCHAR2(30),mc_mach_cd1 VARCHAR2
(30),mc_prep_cd2 VARCHAR2(30),mc_mach_cd2 VARCHAR2(30));
INSERT INTO OM_MC_MASTER VALUES ('MISC','TEE SCH','IR','HO','RE','HO');
insert into om_mc_master values('MISC','Vertical Brace','R','HM','I','HO');
insert into om_mc_master values('MISC','Pipe','IR','HO',NULL,NULL);
INSERT INTO OM_MC_MASTER VALUES ('GRAT','PL','RE','HO',NULL,NULL);
SQL> SELECT * FROM OM_MC_MASTER;
[code]....

View 6 Replies View Related

SQL & PL/SQL :: Concatenation On Columns

Feb 23, 2012

I have problem with query ( i'll only use DUAL table for example):

SELECT T.DUMMY P1,
T.DUMMY P2,
T.DUMMY C1,
T.DUMMY C2,
T.DUMMY C3,
T.DUMMY C4,
T.DUMMY C5
FROM DUAL T;

I need to concatenate only columns with name starting with C and add separator between them. Is there any function do concatenate columns using separator like:

SELECT T.DUMMY P1,
T.DUMMY P2,
DBMS_SOMETHING.SOME_FUNCTION(',', C1,C2,C3,C4,C5)
FROM DUAL T;

Or I must do like this:

SELECT T.DUMMY P1,
T.DUMMY P2,
C1 || ',' || C2 || ',' || C3 || ',' || C4 || ',' || C5
FROM DUAL T;

problem is that I have 3.000+ columns in 23 different selects :/

View 3 Replies View Related

SQL & PL/SQL :: Dynamic Sql Query String - Getting Error?

Aug 22, 2010

FUNCTION get_attributed_sedol( p_ref_number IN VARCHAR2,
p_field IN VARCHAR2 )
RETURN VARCHAR2
IS
l_query VARCHAR2(1000);

[code]...

It gives me an error on the line where the execute immediate statement is.
Quote:
ORA-00905
missing keyword

Cause: A required keyword is missing.

Action: Correct the syntax.

But when I check my stack trace table to see what the actual query string looks like, I see this

Quote:
SELECT sedol INTO l_attributed_sedol_code FROM integration.tmp_attributed_sedol WHERE CLIENT_LEDGER_REF='LEAE057090' AND ROWNUM=1

There's nothing wrong with that, is there? It executes fine if I try it manually.

View 3 Replies View Related

Recursion - Concatenation On Database?

Nov 27, 2009

We are using Oracle 11g (11.1.0).I'm not all that prolific when it comes to writing queriesI have a table...

Table1
-----------------------------------------
oid narr parent
-----------------------------------------
1 some narrative null
2 more narrative 1
3 a bit of test narrative 2

Simply put, I need a query that will recurse up through each rows parent and return the concatination of all parents and itself narrative.

Expected output
------------------------------------
some narrative
more narrative some narrative
a bit of test narrative more narrative some narrative

The requirement is that this is one single query as it will be called from a third party application we are using. We need this recursion and concatenation to be done on the database, as while we have control over the database queries that get executed we have no control over the internal source of this third party applications.I have been digging around for a bit, I have tried using a combination of JOINS and UNIONS but keep hitting a brick wall.

The best I could come up with is...
SELECT concat(n1.narr, n2.narr) FROM table1 n1
JOIN table1 n2 ON n1.oid = n2.parent

But this only returns two lines, for oid's 2 and 3, and only concatinates with the immediate parent.

View 1 Replies View Related

Concatenation Of Fields For Output

Mar 15, 2007

I have the following fields:

Addressln1
Addressln2
Suburb
Town

I know how to concatenate them

trim(Addressln1) || ',' || trim(Addressln2) || ',' || trim(Suburb) || ',' || trim(Town) as Address

1. I would like to know if any of the fields are empty I would like to eliminate the comma character from the string.
2. Can I replace the comma with a new line character and what character to be used in the syntax.

View 2 Replies View Related

How Many Quotes To Use In Dynamic Query Using IN Clause With String

Nov 23, 2011

I have a dynamic query which has this clause in it: WHERE [COLUMN NAME] IN (' || theString || ')

My problem is that theString is being passed in through a C# call and the variable is a bunch of strings concatenated together and separated by a comma. Ex: theString = "'val1','val2'"

How many quotes are supposed to go around val1 and val2?

I've tried the following and none work:
'val1','val2'
''val1','val2''
''val1'',''val2''
'''val1'',''val2'''
''''val1'',''val2''''

When I run the procedure in Oracle it works with '''val1'',''val2'''

View 1 Replies View Related

Select Query Matches Part Of The String

Mar 11, 2010

Select * from XXX where xxx.a in �123,456�-----> this values comes dynamic to my query.

Here xxx.a will contain values like 123 or 456 like that .

View 6 Replies View Related

SQL & PL/SQL :: Query To Split Character String Using XQUERY

Aug 5, 2010

I am using this query to split numeric values i.e ('1,2,3,4,5,6')but when i am trying with char value i.e ('a,b,c,d'), its not working.

select id
FROM employee e
WHERE e.id IN
( SELECT TO_NUMBER(xt.column_value)
FROM XMLTABLE('1,2,3,4,5,6') xt );

View 6 Replies View Related

SQL & PL/SQL :: Convert Column Value To Delimited String Using Query?

Jan 10, 2012

I want to convert a column value to a delimited string using a query.

Example

TableA
Col1 Col2 Col3
1 x200 MIS-X
2 x200 BTS-X
3 x200 TYR-X
4 x100 YRY-X

Select Col3 From TableA where Col2 = 'x200'

Expected Output:

'MIS-X','BTS-X','TYR-X'

View 4 Replies View Related

SQL & PL/SQL :: Space In Every Character Of A String With Single Query

Mar 19, 2012

How can we get 'space in every character of a string with Single select query'

for example:-
string 'INDIA'
result should be 'I N D I A'

View 1 Replies View Related

SQL & PL/SQL :: Query To Return Value / String If No Records Found

Jun 17, 2012

Having following table:
UserID REC_TYP REC_CD
12345 'OFFR' 12
23456 'MSG' 13

I'd like to construct the query which in this particular case would return the REC_CD as 'Record_ID' for REC_TYP='OFFR' where USERID=? (always fetched by the application) and if such USER_ID doesn't exists (for the particular REC_TYP of course) to return string or any other value. e.g. The result for this query in case of user_id 23456 = would be "doesn't exist" or sth for instance 'FALSE' and for 123456 it would be '12'

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved