Need inputs on CONVERT function in oracle.
My source DB is : US7ASCII
My target DB is : AL32UTF8
Basically I am using oracle CONVERT funciton to convert the data.
Unforutnately AL32UTF8 is not predefined in CONVERT function.
So, is there are any other ways to convert the data ? Plz let me know.
Thx,
Vi.
You have two databases. Database A uses a US7ASCII character set. Database B uses an AL32UTF8 character set.
- Is all the data in Database A actually US7ASCII data?
- What version of Oracle is Database A running? What version of Oracle is Database B running?
- On which database are you running the CONVERT function?
- Why do you believe you need to use the CONVERT function? If you are moving data from one database to another, Oracle should automatically take care of character set conversion.
Justin
Similar Messages
-
Need Assistance for VBA function in oracle how to implement
My very respected and Senior, regards,
Sir, hope you will in best of health and wealth by the grace of God,
Sir, i have a request problem as i m very junior against you and you have passed this time before many years ago as i m standing where. Sir i m a very junior developer of oracle and have a problem putting on your desk with the hope that you can help my as a boss.
Sir me have to calculate yield of Bond using oracle form
i have tried my best and tired
there is a formulae in excel which give the Yield() when we provide the parameters
and i need the excel formulae or the oracle calculation code of PLSQL for this.
How can i get yield when i have price, coupon rate, frequency, issue and maturity of the coupon , coupon period , next coming coupon , and others detail.
or tell me how to use EXCEL VBA for this problem ,
thnx n regards,
yours student, junior developer youngest brother
Faraz
How can I get the solution using Excel VBA function with oracle
so that move values to excel calculate them and copy the result from excel to oracle formsHi,
for the Hex-Number-conversion see:
[url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
What number format do you have? YYYMMDD
Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
Please describe further.
Bye
stratmo -
Need help for Conversion Function in Oracle
Hi, Can Any One help me Please.
I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
Thanks In Advance.Hi,
for the Hex-Number-conversion see:
[url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
What number format do you have? YYYMMDD
Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
Please describe further.
Bye
stratmo -
CONVERT function in SQL Server to oracle
All,
How to convert CONVERT function in SQL Server to oracle, below mentioned format is in SQL Server:
variable1 = convert(numeric(20), SUBSTRING( parameter1,parameter2,parameter3)
parameter1 datatype nvarchar2(100)
parameter2 datatype bigint
parameter3 datatype bigint
I did bit R&D, but was not successful..but still getting on..
If any help that would be great...
Regards,
~ORAYou cannot specify the precision/scale or length of input paramters to a stored procedure in Oracle, or at least the pl/sql engine does not respect the sizing. Assuming that you want to do something with variable1 in the procedure, and not just return it, the Oracle equivalent would be something along the lines of:
SQL> CREATE FUNCTION f (p_param1 IN VARCHAR2,
2 p_param2 IN NUMBER,
3 p_param3 IN NUMBER) RETURN NUMBER IS
4 l_var1 NUMBER(20) := SUBSTR(p_param1, p_param2, p_param3);
5 BEGIN
6 RETURN l_var1 * 10;
7 END;
8 /
Function created.
SQL> SELECT f('ABC10DEF', 4, 2) FROM dual;
F('ABC10DEF',4,2)
100You may need to adjust the return type to match what you are actually returning.
You can also use this iin a direct assignment in pl/sql without doig a select, something like:
SQL> DECLARE
2 l_num NUMBER(20);
3 BEGIN
4 l_num := f('ABC10DEF', 4, 2);
5 DBMS_OUTPUT.Put_Line('The number is: '||l_num);
6 END;
7 /
The number is: 100John -
Converting db2 user defined functions to oracle .
Hi gurus
this is a user defined function for getting current timestamp for a null value how to do this in oracle .i am getting a problem at the input values.can anyone suggest me the changes to convert it into oracle udfs.
drop function Get_DateId()
CREATE FUNCTION Get_DateId()
RETURNS BIGINT
BEGIN ATOMIC
DECLARE R BIGINT;
DECLARE v_Day CHAR(2);
DECLARE v_Month CHAR(2);
DECLARE v_Year CHAR(4);
SET V_Day = SUBSTR( DIGITS (DAY(CURRENT DATE)),9);
SET V_Month = SUBSTR( DIGITS (MONTH(CURRENT DATE)),9);
SET V_Year = RTRIM(CHAR(YEAR(CURRENT DATE)));
SET R= BIGINT(v_Year||V_Month||V_Day|| '00000000' );
RETURN R ;
END
@You'll need to get the syntax for PL/SQL function calls right. You will need something like
create or replace function whatever( arg datatype, arg datatype...) return varchar2 is
--define any local variables here
begin
return to_number(to_char(systimestamp,'the edit mask you want to use'));
end;
/You might do the conversion inline and dispense with the function compeletly if you're just generating a value. -
CONVERT function from SQL-Server 7.0 to Oracle
Whenever a Convert function appears in the T-SQL, WorkBench converts it to RPAD and doesn't warm about it. How can I avoid this situation???
It`s very urgent!! I`ve to migrate an entire system and I`m very short of time.
Any comment would be helpfull!! Thanks!
Julieta.THIS IS A DUPLICATE ENTRY AND REPLY, PLEASE USE ADD ADDITIONAL NOTES TO THE OTHER REPLY
This has been logged as bug 1902143.
Is altering the output from RPAD(12, 5, ' ') to RTRIM(RPAD(12, 5, ' ')) sufficient?
Until this bug is fixed and released the only suggestion I can make is Generate Migration Scripts from the Action menu and then
use an editor to alter the RPAD() to RTRIM(RPAD()).
Turloch
Oracle Migration Workbench Team -
Convert Date function to oracle
The follwoing Sql for Sqlserver, what is the equivalent function in oracle. Need help on this.
YTD:
YOUR_DATE_FIELD between DATEADD(yy,
DATEDIFF(yy,0,@Prompt('BEGIN_DATE','D',,mono,free)), 0) AND
@Prompt('END_DATE','D',,mono,free)
MTD:
YOUR_DATE_FIELD between DATEADD(mm, DATEDIFF(mm, 0,
,@Prompt('BEGIN_DATE','D',,mono,free)), 0) AND
@Prompt('END_DATE','D',,mono,free)
WTD
YOUR_DATE_FIELD between (,@Prompt('BEGIN_DATE','D',,mono,free) -
DATEPART(dw, ,@Prompt('BEGIN_DATE','D',,mono,free)))+1 AND
@Prompt('END_DATE','D',,mono,free)Extracting month,year,day from sysdate (You may even opt to use to_char)
SQL> select extract (month from sysdate) from dual;
EXTRACT(MONTHFROMSYSDATE)
4
SQL> select extract (year from sysdate) from dual;
EXTRACT(YEARFROMSYSDATE)
2007
SQL> select extract (day from sysdate) from dual;
EXTRACT(DAYFROMSYSDATE)
5
Adding 5 days to today's date
SQL> select sysdate + 5 from dual;
SYSDATE+5
10-APR-07
Adding Months
SQL> select add_months(sysdate,3) from dual;
ADD_MONTH
05-JUL-07
Date Difference
SQL> select sysdate - to_date('01/04/2007','dd/mm/yyyy') from dual;
SYSDATE-TO_DATE('01/04/2007','DD/MM/YYYY')
4.42670139
Date Difference
SQL> select trunc(sysdate) - trunc(to_date('01/04/2007','dd/mm/yyyy')) from dual
TRUNC(SYSDATE)-TRUNC(TO_DATE('01/04/2007','DD/MM/YYYY'))
4
SQL> -
Friends and Gurus,
Table: comments
column: c1
characterset: WE8IS08859P1
I am trying to use Oracle convert function to identify rowid's where column length greater than 4000 characters.
Table comments was created under 'WE8IS08859P1' characterset and I'm moving this table to 'AL32UTF8'.
I don't have csscan installed so trying to query sql and convert column to 'AL32UTF8' characteset and find rowid's to fix.
I have tried below but doesn't help
SELECT MAX(length(CONVERT(c1,'AL32UTF8'))) FROM comments;
SELECT length(CONVERT(c1,'AL32UTF8'))
FROM comments
WHERE length(c1) > 4000;
did anybody faced similar issue?Hi,
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables involved, so that the people who want to help you can re-create the problem and test their ideas.
Simplify the problem as much as possible. For example, instead of looking fro strings that have more than 4000 characters (or bytes), post a problem where you want to find strings longer than 4 characters (or bytes).
Always say which version of Oracle you're using (for example, 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002
Are you interested in the number of characters, or the number of bytes? Use LENGTHB if you want the length in bytes. -
Does the iPad mini have a setting so it can be used with either 120 or 240 electrical current? If yes, how do you go about setting the desired input voltage? I will travel to Northern Europe and want to know if I will need a voltage converter.
The iPad charger is dual voltage. You need only a plug adapter to be able to plug your US charger into a European wall outlet. A basic one costs about $2.00. - $6.00. Like this...
http://www.amazon.com/CVID-Grounded-European-Adapter-Adaptor/dp/B0098B5GN8/ -
I have a MacBook Pro that I want to hook up the Mini Display Port video out to a TV with RCA video imput, or a TV with S-video iimput.
How do I do this, and do I need a video converter?
Dennisthere's an adaptor for mini dvi to s-video
a well known auction site would yield results if apple don't stock it -
Converting the iif function in MS Access97 to an user defined function in Oracle
Hi ,
I have a problem here we are working with Visual Basic 6.0(ADOs 2.5) with Oracle 8i release 2. we have some queries stored in the tables which contains the iif function of MS Access 97 do we have a similar built in function in Oracle which replaces this iif function of Ms Access 97.
we cannot use decode (built in function) of oracle b'cos it cannot be used in a where clause and we cannot write a user defined function also because it cannot be generalized for use b'cos sometimes we use
field names and sometimes values as expression in the iif functions
If anybody could suggest me some idea
please mail me at [email protected]
with best regards
Jai<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jai:
Hi ,
I have a problem here we are working with Visual Basic 6.0(ADOs 2.5) with
Oracle 8i release 2. we have some queries stored in the tables which contains the iif function of MS Access 97 do we have a similar built in function in Oracle which replaces this iif function of Ms Access 97.we cannot use DECODE (built in function) of oracle b'cos it cannot be used in a where clause and we cannot write a user defined function also because it cannot be generalized for use b'cos sometimes we use field names and
sometimes string values as expression in the iif functions. is there any other built in function ? can anybody suggest me some idea
please mail me at [email protected]
regards
Jai<HR></BLOCKQUOTE>
Hi,
You still can use the seccond approach - with a udf IIF() that you place in a package and OVERLOAD it. See the documentation for limitations of Overloading
Overloading permits you to declare several functions with the same name but havind different behaviours depending on the number and type of the parameters.
George -
Oracle CONVERT Function use in ODI
Hi,
I am using the convert function while doing data transfer between 2 databases in ODI.
The NLS_CHARACTERSET of source data base is WE8ISO8859P1 and that of the target is AL32UTF8.
When I use CONVERT(v_string, WE8ISO8859P1, AL32UTF8) as a target column expression in ODI Designer, it converts the pound symbols '£' in source data to '¿' in the target database. But for all other usual characters there is no such problem observed
If anyone has faced such issue and resolved it or know any workaround, your help would be appreciated.
Thanks.Don't pass the '£' character in the v_string and simply pre-pend it to the correctly converted string
-
Conversion function in Oracle.
Hi,
So below is the scenario I have. I was wondering if there is any function oracle provides or is there any way I could achieve this.
CREATE OR REPLACE procedure TestA
partnumber IN number,
partsubnum IN varchar2,
errstring OUT varchar2
) as
-- Declare local variables
ll_inputpartnum varchar2(100);
Begin
ll_inputpartnum := partnumber || partsubnum; -- Concatinate partnumber and partsubnum
-- Will need to convert this variable to number.
TestB.Process(ll_inputpartnum,parameter2, s_errstring, errnum); --ll_inputpartnum must be of type number
if errnum <> compkg.success then
errstring := s_errstring;
return;
end if;
Exception
When others then
Null;
End;
/I do not have option to change anything on TestB.Process Procedure.
So there are two problem I am trying to solve in this scenario.
First, the input parameter - ll_inputpartnum in TestB.Process takes input of only number type. So i need to somehow convert the concatenated ll_inputpartnum into Integer.
Second problem is, Procedure TestB.Process - after completing its processing, passes ll_inputpartnum to the Third procedure. Let's say Procedure TestC. So in Procedure TestC, I need to again break down the concatenated value into original partnumber and partsubnum.
The concatenated value - ll_inputpartnum does not change through out this process.
So, i am trying to figure out the best way to approach this situation.
Thank you
Edited by: ARIZ on May 25, 2010 1:18 PMwith a function like (using William's package too)
function combine_parts(p_partnum in integer,p_partsubnum in varchar2) return integer is
l_length pls_integer := 5; /* adjust to the maximum possible length of partsubnum */
hex_val varchar2(5) := '';
begin
if length(p_partsubnum) > l_length then
return 0;
end if;
for i in 1 .. l_length loop
hex_val := hex_val || to_base(ascii(substr(lpad(p_partsubnum,l_length,chr(0)),i,1)),16)
end loop;
return p_partnum * power(256,l_length) + to_decimal(hex_val,16);
end;you can simply
ll_inputpartnum := combine_parts(partnum,partsubnum);and finally the parameter ll_inputpartnum can be fed to the appropriate process
you'll need another function to regain partnum and partsubnum in another process because it will just ll_inputpartnum
function concatenated_parts(p_number in integer,p_separator in varchar2 default '|') return varchar2 is
l_length pls_integer := 5; /* adjust to the maximum possible length of partsubnum */
hex_val varchar2(5);
chr_val varchar2(5) := '';
l_partnum integer;
begin
l_partnum := trunc(p_number / power(256,l_length));
hex_val := to_base(p_number - l_partnum * power(256,l_length),16);
if length(hex_val) > l_length then
return '';
end if;
for i in 1 .. l_length loop
chr_val := chr_val || chr(to_decimal(substr(hex_val,i,1),16));
end loop;
return to_char(l_partnum) || p_separator || chr_val;
end;Regards
Etbin
p.s. the functions are not tested (no database at home) -
Need help in converting date format
Hi,
Need help in converting date format from 'DD-MON-YYYY' to 'YYYY-MM-DD' in an .rtf template as I believe xml publisher supports the date format as 'YYYY-MM-DD' only.
Thanks,
Raj.I got the same problem, anyone know how to solve this problem? I allready found some date functions on http://blogs.oracle.com/xmlpublisher/2008/09/date_functions.html . I also tried <?xdoxslt:month_name(xdoxslt:get_month(xdofx:substr(NEED_BY_DATE, 4,3)), $_XDOLOCALE), 0, 'nl-NL')?>, but then it returns a namespace error (Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.). Anyone know how to fix this?
Edited by: user11165753 on 7-dec-2009 23:50 -
Need help in to_char function
Hi All,
I'm using below sql query to get sysdate with time stamp.
select to_char(sysdate,'YYYYMMDD HH24:MM:SS') from dual
This gives me below result: 20130816 05:08:49
Strangely, when I keep on running the same query, I notice after 60 seconds are complete, time stamp starts with 20130816 05:08:01 again.
Am i missing something here..
Thanks in advanceKarthick_Arp wrote:
Keep a simple thing in mind. Date stored in the DB does not have any format. Format need to be applied while you display. The default date format is specified by the NLS_DATE_FORMAT parameter. You have used TO_CHAR to display date in a specific format. But the problem is that you have converted DATE into string. So if its just for display purpose then set the NLS_DATE_FORMAT, do not use TO_CHAR.
With respect to your issue You need to represent Minute as MI. You have represented it as MM (Month) That's why you see 08 always.
" the problem is that you have converted DATE into string"
No, the problem was that he was explicitly using an incorrect format mask, specifying months where he should have specified minutes.
The problem inherently cannot be the result of converting a DATE into a string. Dates are always converted to strings for presentation, either implicitly by using the controlling setting of NLS_DATE_FORMAT (which can be set at several levels) or explicitly by using the to_char function. Oracle will always convert. It has to. Internally, a date is binary gibberish. But computer screens and printers can only show strings of characters, so the DATE will be converted to a character string, by hook or by crook. And the method of oracle making that conversion is exactly the same. The only thing that varies is how the user chooses to make that specification. And "not choosing" (by not using the to_char function) is still choosing ... choosing to rely on nls_date_format.
Maybe you are looking for
-
Flex 3 to Flex 4.5.1 Error (UIComponent)
When I change flex 3 to flex 4.5. I keep the almost code and change the essitial code to pass the complie of flex 4.5 But when I did the debug, the system just the fault at the webservice module. The server dispatch event to the webservice which conn
-
Error when importing a .fxp file
When I try to import a .fxp file, I get an error: An error occured when attempting to open the FXP file. Verify if any other applications are using this file or if the destination directory has writer permissions. Thank you for any help you can provi
-
Grid Control installation for 11G: is 10g grid required ?
Dear All, We are currently using the local dbconsole for the monitoring and doing administrative work on our 11g database. My limited experience and observation indicates that 11G does not have its own enterprise Grid control yet and it requires the
-
Error with spring configuration
Hi, I have incorporated spring into the livecycle data services using Jeff Vroom's springfactory but I still get an error everytime of 'bean not found' even though it has been defined in the applicationcontext. Here is the definition of the service i
-
EJB deployment on AIX and True64
Hi, I heard that due to JDK licensing issues, the deployment of EJBs needs a separate download of JDK on weblogic on AIX and Tru64. Without this step, the depployment and running ejbs would fail. Can anyone please confirm that it is the case? Thanks