473,804 Members | 3,745 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Maping Oracle nvarchar2(lengh t) to PostgreSQL varchar(lenght)

Dear friends,

I studying the possibility to port Compiere CRM from Oracle to PostgreSQL. As
Compiere evolves nearly everyday in CVS, I would like to run the Oracle code
without (too much) modification.

Don't blame me, I know using search/replace works most of the times.

At first, I used CREATE TYPE syntax to map Oracle nvarchar2 to PostgreSQL
varchar type (see code #1). The code seems to be the equivalent of:
CREATE DOMAIN nvarchar2 as varchar;

Now I can create tables with nvarchar2 but not nvarchar2(lengh t).

Is there a way to map Oracle nvarchar2(lengh t) to PostgreSQL nvarchar or
nvarchar(lenght ) in PostgreSQL 7.3?

Are there plans to allow such mapping in the future using the CREATE DOMAIN
syntax?

Best regards,
Jean-Michel Pouré

*************** *************** *************** *************** **********
Code #1
--DROP TYPE nvarchar2 CASCADE;

CREATE OR REPLACE FUNCTION oracle_nvarchar 2in(cstring, oid, int4)
RETURNS nvarchar2 AS
'varcharin'
LANGUAGE 'internal' IMMUTABLE STRICT;
COMMENT ON FUNCTION oracle_nvarchar 2in(cstring, oid, int4) IS '(internal)';

CREATE OR REPLACE FUNCTION oracle_nvarchar 2out(nvarchar2)
RETURNS cstring AS
'varcharout'
LANGUAGE 'internal' IMMUTABLE STRICT;

CREATE TYPE nvarchar2
(INPUT=oracle_n varchar2in, OUTPUT=oracle_n varchar2out, DEFAULT='',
INTERNALLENGTH=-1, ALIGNMENT=int4, STORAGE=EXTENDE D);
COMMENT ON TYPE nvarchar2 IS 'Oracle type nvarchar2(lengt h) mapped to
PostgreSQL type varchar(lenght) ';
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 12 '05 #1
0 5528

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
22152
by: Alex | last post by:
I'm new to Oracle, so this question may sound silly. I have been given a list of Oracle tables (they may be views, I'm not sure) that are available to me. I can run simple SQL select statements against most of them in SQL Plus. But some of them have "slashes" in their names such as /XYZ/CUSTOMERS or /XYZ/ADDRESSES . When I try to use the name the way it's listed (with slashes) I get an error. I even tried replacing the slashes with dots,...
4
5766
by: BadMan! | last post by:
Hi all, I'm trying to use sqlloader to import a database with multiple different tables which has been exported to one single plain text file. No fixed lenght. Let's say database.txt is something like fruits,orange,orange fruits,banana,yellow fruits,pear,green users,John Doe,25,34,26th upper street,0, 12-2-2003
8
2530
by: Jean Pierre Daviau | last post by:
for (var i=0; i< document.images.lenght; i++){ totalWidth = totalWidth + document.images.width; totalHeight = totalHeight + document.images.height; } -- X trême newbe ....... masm32 windows Xp
1
2447
by: Chilly | last post by:
I am new to creating scripts and can do basic select and update scripting. I am trying to extract information from an Oracle database. The table is CAT1 and the fields are PART and FSC. I want to extract all lines in the PART field that match the FSC. The part field has a max of 20 characters and the FSC has a exact lenght of 4. I used a script to view the first 4 characters of the PART field SELECT SUBSTR(PART, 1, 4)AS PART FROM CAT1 ...
12
3738
by: Mikito Harakiri | last post by:
I wonder if WITH RECURSIVE MaryAncestor(anc,desc) AS ( (SELECT parent as anc, child as desc FROM ParentOf WHERE desc = "Mary") UNION (SELECT A1.anc, A2.desc FROM MaryAncestor A1, MaryAncestor A2 WHERE A1.desc = A2.anc) ) SELECT anc FROM MaryAncestor
22
11604
by: jdokos | last post by:
Hello, I have a question about VARCHAR fields. Our application groups here are starting to use VARCHARs much more frequently. Even VARCHAR (2) to (9) length fields. They say this is because some of the application programs, specifically Java Beans cannot handle the spaces after the value in CHAR fields. Is anyone else seeing this trend?
1
6755
by: Ramesh | last post by:
string conString = "user id=perksmgr; password=rgmskrep; data source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 180.25.10.2)(PORT = 1551)) ) (CONNECT_DATA = (SERVICE_NAME = REKS816) )) " ; con = new OracleConnection(conString); Plese send me compleate details, how to connecto to the database. ERROR IS LIKE THIS :- Invalid length for connection option 'data
13
13972
by: mike_dba | last post by:
I am having some data reject on an insert of Japanese characters to a Varchar column in my DB2 UTF-8 database. I am trying to understand how big to make the Varchar column for the inesert to work successfully for all of my data. I would also like ot understand if Vargraphic is a better approach and what ramifications that might have. This data is sourced from UTF-8 Oracle (using byte semantics) which defines a columns as...
5
2199
by: Naveen Kumar Srivastava | last post by:
Hi to All I want to create a table in oracle having name more than 16 character how i can? I know that oracle support table namt upto 28 character by default it support 15 character but i don't know how to change size. If any one know please reply me. Thanks
0
9584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10337
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2995
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.