SQL & PL/SQL :: Converting Varchar2 To NVHAR And NVarchar2?
Feb 16, 2011
I have written a trigger & procedure to call a webservice from pl/sql procedure. Everything was working fine until I was told to use nchar & nvarchar2 instead of varchar2 as per requirement. Now I am not able to run the procedure and getting errorcode with return response from server.
I didn't changed the width of columns but only datatype. What precautions do I need to take in code while doing this and what could have caused the error only by converting the data type.
View 5 Replies
ADVERTISEMENT
Aug 16, 2011
i have a varchar2 column containing string values that can be converted to date i.e. ('31-JUL-11') and that column also contains text strings in it. i.e. ('Some string data...')
records whose column value can be converted to date are extractable via where clause (i.e. those rows are associated with some fix number / flag)
now when i try to use to_date function i get the error that
" ORA-01858 a non-numeric character was found where a numeric was expected "
in sql i have added a where clause to only pick rows with flag, but even then it gives the error.
using a subquery in the from clause eliminates the error, but when i create it in a view it again gives the same error.
View 8 Replies
View Related
Oct 24, 2007
i am fairly new in the oracle arena, but what would cause a statement such as
ALTER TABLE TEST_TABLE MODIFY text_field1 varchar2(100) DEFAULT 'testval' NULL
to change a column's type from VARCHAR2(100) to VARCHAR2(100 byte)? i found a few mentions of the 100 byte concept online but nothing that jumped out at me.
View 2 Replies
View Related
May 11, 2011
I'm having some issues with my NVarchar2 columns that I want to solve
My current NLS_CHARACTERSET is 'AL16UTF16', and therefore I can only create NVarchar2 columns with an maximum extension of 2000 bytes. But I do need a column with 4000 bytes length. How can I create an 4000 NVarchar2 column?
(I do not want to use a CLOB column...only a NVarchar2)
View 5 Replies
View Related
Feb 21, 2010
I have a table which have almost 90000 rows.
1. The datatype of some columns is NVARCHAR2. I want to change it to VARCHAR2 and NUMBER for some.
View 5 Replies
View Related
Apr 29, 2011
have a performance problem with a simple query, for example:
SELECT *
FROM CA_ADDRESS
WHERE address_k1 = 'L163'
I have an index created in column address_k1. CA_ADDRESS is a 3-4 Million Record table.
I need to improve the performance of the query. How I can improve it?
View 3 Replies
View Related
Sep 3, 2013
I have table desc xx_testName
Null Type
-------- -------- --------------
COL1 NOT NULL NVARCHAR2(100) COL2 NOT NULL NVARCHAR2(100) COL3 NOT NULL NVARCHAR2(100)
i am able to query select * from xx_test however if i query as select col1 from xx_test then it is giving error.
ORA-00904: "COL1": invalid identifier00904. 00000 - "%s: invalid identifier"*
Cause: *Action:Error at Line: 3,131 Column: 13
Let me know how to query NVARCHAR2 column and how can we put in WHERE condition ?
View 5 Replies
View Related
Sep 13, 2011
I want to know, Is NVARCHAR2 available in Oracle standard edition?
View 5 Replies
View Related
Aug 16, 2007
i have 2 tables
A B
id a.id
name
type
There are at most 2 entries of a in b. Depending on the value of the type column in B, this determines whether the entry should be male or female. I want to have a select statement that will retrieve 2 rows into one row essentially like below, how is this done:
id male_name female_name
1 paul paula
the column names will appear as such, if its a 0 its a male name if its 1 its a female name, there will generally be 2 entries in B for 1 value of a.
View 2 Replies
View Related
Feb 21, 2011
I have a column named "col1" with datatype "varchar2(10)" and row wise entries like "1,1A, 2,3...,10,2A,..." like. I want to order it like "1, 1A ,2,2A, 2B,3... 10...".I tried it with to_number() but it gives me
1,10,11,2,....like that.
View 14 Replies
View Related
Jun 13, 2012
What is the best alternative to using VARCHAR2 if the output gets truncated after 4000 bytes in a PL/SQL function?
View 10 Replies
View Related
Mar 23, 2010
in our application we are using clob column instead of varchar2 because varchar2 does not allow more that 4000 chars, so Using clob allows to put data of any length, will it cause performance issues ? we have this column in almost in all tables .
View 2 Replies
View Related
Sep 28, 2010
create table members(
memberID varchar2(7),
locationID number(5),
roomID varchar2(5)
)
/
[Code]....
MEMBERI LOCATIONID ROOMI
------- ---------- -----
2007209 1 1
2006253 1 1-A
2006253 1 1-A
2006265 1 1-B
2006240 1 1-C
2005064 1 1-D
2007836 1 100
2007211 1 101
2007075 1 102
2007110 1 105
[Code]...
Function created.
SQL> select * from members
2 order by safe_to_number(roomID);
MEMBERI LOCATIONID ROOMI
------- ---------- -----
2007209 1 1
2007185 1 2
2007089 1 3
2007023 1 4
[Code]....
How can I sort the output to get the result like below
2007209 1 1
2006253 1 1-A
2006253 1 1-A
[Code]...
and so on...
View 13 Replies
View Related
Aug 22, 2013
Getting error ORA-00932: inconsistent datatypes: expected NUMBER got CHAR Source row:
NOTE_IDCONTRACT_GRANT_IDPROSPECT_IDPROGRAM_CODE
1 1 1 786
2 2 2 786
Program:
SELECT
CASE
WHEN "PIVOT_ROW_GENERATOR"."ID" = 0 THEN
"PIVOT_SOURCE"."ID_NUMBER"
WHEN "PIVOT_ROW_GENERATOR"."ID" = 1 THEN
"PIVOT_SOURCE"."ID_NUMBER"
[code].........
View 3 Replies
View Related
Jul 14, 2012
I have two tables as follows:
TABLE_1
ID ENTRY_DATE VALUE
------- --------------- ----------
1 1-JUN-12 21
1 2-JUN-12 51
1 3-JUN-12 232
1 4-JUN-12 221
1 5-JUN-12 424
.
.
.
.
1 26-JUN-12 52
1 27-JUN-12 0
1 28-JUN-12 247
1 29-JUN-12 528
1 30-JUN-12 489
2 1-JUN-12
2 2-JUN-12
2 3-JUN-12
2 4-JUN-12
2 5-JUN-12
.
.
.
.
2 26-JUN-12
2 27-JUN-12
2 28-JUN-12
2 29-JUN-12
2 30-JUN-12
TABLE_2
ID DAY_1 DAY_2 DAY_3 DAY_4 DATE_5 .......... DAY_26 DAY_27 DAY_28 DAY_29 DAY_30
----- ---------- --------- --------- ---------- ---------- --------- --------- -------- -------- --------
1 21 51 232 221 424 52 0 247 528 489
2
There are millions of DISTINCT ID values in TABLE_1 and corresponding to each ID there are some values for all the days of a month. I need to insert these values in TABLE_2 in the above format.
View 1 Replies
View Related
Mar 24, 2011
I have simple program .It reads binary file and writes all , what reads into another file
WHILE my_lenght_help <= my_lenght LOOP
UTL_FILE.GET_RAW ( g_read_file , my_bufer_read ,200 );
UTL_FILE.PUT_RAW ( g_write_file , my_bufer_read );
my_lenght_help:= my_lenght_help + 200;
END LOOP;
my question. How I can change "my_bufer_read" between UTL_FILE.GET_RAW and UTL_FILE.PUT_RAW to make writable file ascii
View 3 Replies
View Related
Apr 27, 2012
I found this query in my sub version repository and really wondering how this working
select to_char(to_date(1000000,'J') ,'JSP') string_value from dual;
View 1 Replies
View Related
Sep 21, 2010
I am working on a POC. The goal is to do a
select * from function('input')
where the function dynamically returns different tables.
I have gotten to the point where I can return the cursor but I cannot format it as a table to use in the query. It return's it as XML. This is my function:
create or replace
FUNCTION CAMS_FUN_GEN_REPORTS(PARAM1 IN VARCHAR2) RETURN SYS_refCURSOR AS
BEGIN
DECLARE
p_recordset SYS_refCURSOR;
begin
OPEN p_recordset FOR 'SELECT * from STATS_FLAGGED_TOTALS_ME';
RETURN p_recordset;
END;
END CAMS_FUN_GEN_REPORTS;
This is my query:
select * from CAMS_FUN_GEN_REPORTS('')
So normally you would do this
select * from TABLE(CAMS_FUN_GEN_REPORTS('') as tabletype)
But I will never know the end result table as it will be dynamic so I have to find a way to cast the result of the function into a new table I can select on.
I have looked into pipe lining also but from what I can tell you still need to know the table definition. Which I can't know from the client side. The server will control the 'routing' and thus the end result of the select.
View 3 Replies
View Related
Sep 6, 2012
I have a row which contains 6 columns where I want that data to be shown in the form of columns as shown here:
From:
select item1, item2, item3, amt1, amt2, amt3 from item_table where sno=1; <----- returns 1 row as below
ITEM1 ITEM2 ITEM3 AMT1 AMT2 AMT3
---------- ------------ ------------- ----------- ------------ ----------
AAA BBB CCC 10.00 20.00 15.00
Data explanation: item1's (AAA) price is amt1 (10.00), item2's (BBB) price is amt2 (20.00) and item3's (CCC) price is amt3 (15.00). OK.
Now I want that data to convert into columns as shown here:
To:
ITEMS AMT
--------- ---------
AAA 10.00
BBB 20.00
CCC 30.00
I want a SQL to display this data.
I found one query which converts a row into columns, but this does not serve my requirement: [for your reference only]
SQL> select substr( the_string
, decode( level, 1, 1, instr(the_string,',',1,level-1)+1)
, decode( instr(the_string,',',1,level), 0, length(the_string), instr(the_string,',',1,level) - decode( level, 1, 0, instr(the_string,',',1,level-1))-1)
) the_value
from ( select (select item1||','||item2||','|| item3 from item_table where sno=1) ITEMS
from DUAL)
connect by level <= length(the_string)-length(replace(the_string,','))+1
View 11 Replies
View Related
Jun 15, 2012
We are able to insert CLOB into database, Using oracle Text I'm able to search inside clob. [two questions solved ]. The question arise when we need to send this data to application either as file or as text(varchar2).
I'm able to generate file from CLOB using function,unfortunately it resides inside db and developer is not able to access it.
1)There is option to mount application partition inside db and export file over there but it is not viable option according to management.
2)I've Googled the solution to create JAVA API. Which will perform OS command like scp to send file from db to app(or any remote host). For security reason this option is also dropped.
3)I tried dbms_lob.substr but actual text inside clob is too long. File generated from CLOB sized around 5 MB.
So I guess it requires lot of effort if I wanted to convert into varchar2 as out parameter inside function.
So, to give CLOB data to developer as file or as varchar2. I'm not able to get any solution. Is there any other option using database to convert to string/varchar2 from CLOB ? Or do I need to drill down more into third option.
I'm having oracle 10.2.0.5.
View 2 Replies
View Related
Mar 4, 2012
I am converting from 10g to 11g app server and having problem with the exec_sql.execute command. In my 10g version, the code is:
Declare
lv_dbms_journal_cursor exec_sql.curstype;
lv_status INTEGER;
BEGIN
IF (exec_sql.IS_OPEN (lv_dbms_journal_cursor)) THEN
exec_sql.close_cursor(lv_dbms_journal_cursor);
[code].....
After this code caused the 11g forms session to crash, I modified the 11g version to the below, and it still crashes.
Declare
lv_dbms_journal_cursor exec_sql.curstype;
lv_status PLS_INTEGER;
connection_id EXEC_SQL.ConnType;
BEGIN
connection_id := EXEC_SQL.DEFAULT_CONNECTION;
[code]....
View 7 Replies
View Related
Jul 21, 2011
Once a year in the application we have a specific query that gets used a lot. It's an UPDATE that updates a single record in a single table with a few different datatypes, but the issue is happening with one of the VARCHAR2 fields. It updates one VARCHAR2(2000) and three VARCHAR2(4000) fields at the same time.
This year, 9 of the 95 times it was used resulted in one of the VARCHAR2(4000) fields as null in the database. The users would not want this field to be null and 5 of the 9 have told us they entered something (the form they're filling out is a research proposal and leaving this field empty would be pointless because it's part of the funding request, so they're not doing it). The application isn't doing it because it's not consistent. I've checked the application and these fields can't be nulled any other way.
We just found the issue so I looked back over the past years back to 2005. Last year it didn't happen at all. In 2010 it happened a handful of times. Some years there were even more times. It's not always the same field but it's always a VARCHAR2 of at least 2000 characters.
I have a lot more information but it's all just details (let me know if you need to know more). I'm wondering if there is a bug in 10g with these types of fields. I don't believe it's malicious behavior on an individual's part but I suppose that's always possible.
how to research something like this. I tried to get access to Oracle Support and the Knowledge Base I heard they have but it doesn't look like I can do that
View 2 Replies
View Related
May 14, 2011
I have 2 tables.The column in table A is number and Column in table B is a varchar2 datatype.I have to use the Column of table B as a filter to column of Table A.Below is the example.
create table A(Col1 number);
Inert into A values(1);
Inert into A values(2);
Inert into A values(3);
Inert into A values(4);
Create table B(Col1 Varchar2(100));
Insert into b value ('1,2,3');
Select * from A where col1 in (select col1 from b)
Error: Invalid Number
Is there a way to convert the varchar to number.The varchar field have multiple characters (numbers) seperated by commas.
View 7 Replies
View Related
Mar 28, 2008
How to convert a varchar2 column to CLOB when there is a thousands of records in it.
View 15 Replies
View Related
Jan 15, 2013
How to convert varchar2 to number data?
View 8 Replies
View Related
Aug 31, 2012
What is the exact difference between varchar and varchar2?
As i know only the length is the one difference.Apart from this length,what are all the differences?
View 3 Replies
View Related
May 12, 2010
I'm trying to insert CLOB to varchar2 from one DB to another using database link but failed.
INSERT INTO tmp_std_master@aapsbhx.iss.soton.ac.uk
(student_id, title, first_name, middle_name, surname, hus_id,
date_of_birth, email_address, prog_desc --- varchar2 (100)
)
SELECT DISTINCT c.ref1 student_id, c.title, c.firstname firstname,
[code]....
View 16 Replies
View Related
Apr 3, 2013
I keep getting this error when I run my update statement. Here is what the coding looks like. I'm running Oracle 11g.
CREATE TABLE A (
SUPP_CD_EIM VARCHAR2 (20),
SUPP_CD VARCHAR2(20),
DSN_FAC_CD VARCHAR2(5));
[code]......
I want the output to look like
A1_1234
A2_2345
A3_3456
View 2 Replies
View Related
Mar 23, 2010
sort data set A,B,1,2,A1,A2,B1,B2,2B,1000 as A,B,1,2,1000,A1,A2,B1,B2,2B.
I tried with LPAD and EXPREG_REPLACE funtion. But it did not work.
View 13 Replies
View Related
Sep 18, 2009
When I try to convert numeric values � number(19) p.s 111111111111111111, the to_char function returns �1111111111111110000� because the to_char functions doesn�t support precision bigger than 15.
Is there any way to solve it?
View 3 Replies
View Related