473,795 Members | 3,393 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 5527

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

Similar topics

7
22151
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
5765
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
2529
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
2446
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
11602
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
6754
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
13963
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
9519
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
10214
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...
1
10164
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
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
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5437
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
2
3723
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.