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
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.
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]...
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.
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
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.
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.
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;
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.
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.
Every prospect person in the prospect table are approached with a proposal. This proposal record is stored in the proposal table. Proposal is managed by many primary and proposal managers over the period of proposal. They are assigned the proposal in the assignment table. Primary managers have an assignment type 'PM' and proposal manager have a assignment type of 'PS'
i Need to make below1 and 2 changes to the script.
1-when proposal is current (proposal.active_ind = 'Y' ) then extract only currently assigned primary and proposal managers (assignment active_ind = 'Y') and these managers should be assigned after the proposal has started (assignment.start_date >= proposal.start_date )
2-when proposal is not current (proposal.active_ind = 'N' ) then extract even not curRent assigned primary and proposal managers (not use this in criteria assignment active_ind = 'Y') and these managers should be assigned only after the proposal has started (assignment.start_date >= proposal.start_date )
Primary/Proposal Manager column : Format to print as below:
All Primary managers seperated with space "/" between and all proposal managers after that and "*" at the end
For Example : Mary Steve Roger / Chris Danny Veronica * also, current script only extracts 5 primary managers and 4 proposal managers but thats ok. i can put 10 max(decode statements in the output cause i think they cannot have more than 10 managers.
I'm facing some problem even after using INSTR function in Oracle.The problem is I have written the logic in the PL/SQL block which appends all the values fetched in a loop on the basis of whether the string is present or not.
For ex:
The first value fetched from the select query first is ABCDEFG which gets appended to a variable The next value fetched is AB even this has to be appended to the variable since this exactly doesn't match with ABCDEFG. The next value fetched is BCDEF even this has to be appended to the variable since this exactly doesn't match with ABCDEFG. The third Value fetched is ABCDEFG this will not get appended presently according to the logic which is correct.
writing that piece of code to append the value fetched which doesn't exactly match with the existing string
How to get 'MEAL' string? The length of the string can be various. Means, 'MEAL' can be 'INFLIGHT'. So, i cant use the substr. Is there a function that can recognize the pipeline? so that i can remove all the string before the pipeline and after the pipeline to get the string between the pipeline?
I have the following set of numbers that i am passing in as one input into a stored procedure.
234,456,234,456,567
Now i want to take this list of numbers and use it in an IN statement:
select * from table where column_a in (P_INPUT);
however, when i try this, it give me an invalid error. I have tried inserting single quote around each value and get the same invalid error. I tried a To_char around my column, which solved the error, but it never finds a match!
I want to create a strung together list of ATM IDs for each ATM Location (as one ATM Location(City) can have many ATMs(term ids) this is to allow transaction facts to be not broken down on several lines depending on how many term ids there are for that ATM Location (whenever a new ATM is set-up, a new row is created in the ATM table).
I know I can string it together using a function but I do not have rights to do it so I created SQL in which I feed in the ATM Location as a parameter. I want to do this for ALL ATMs but that is taking forever - is there any way to optimize the below code.
Select max(term_id),atm_location from (Select (SYS_CONNECT_BY_PATH(TERM_ID,' ' ) ) term_id,atm_location from (select term_id , atm_location from ATM_TABLE order by term_id asc ) Start with TERM_ID IN (Select max(Term_ID) from ATM_TABLE group by ATM_LOCATION )
I want to replace numeric values of a specific format with 'X' , find the below example and note that the string in the example only for sample values and the strings may be different.