473,394 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Please help re function packaging...

Anyone please help... I'm a newbie on creating
functions in postgresql.

Here is an oracle package that I'm trying to port to
postgresql:

CREATE OR REPLACE PACKAGE BODY NewsPkg.NewsTools
AS
PROCEDURE del_news (i_id IN VARCHAR2)
IS
BEGIN
DELETE FROM tbl_news_type
WHERE uniqueid = i_id;

DELETE FROM tbl_news
WHERE uniqueid = i_id;
END del_news;

PROCEDURE upd_newstype
IS
CURSOR cur_news
IS
SELECT uniqueid
FROM tbl_news_type
WHERE mother_id IS NULL
GROUP BY uniqueid;

v_id tbl_news_type.uniqueid%TYPE;
BEGIN
OPEN cur_news;

LOOP
FETCH cur_news INTO v_id;
upd_mothernews (v_id);
COMMIT;
END LOOP;

CLOSE cur_news;
END upd_newstype;
END NewsTools;

Can anyone help me on how this oracle package would
look like in postgresql... I would really appreciate
it if someone could show me even the synopsis of this
code in postgresql. I've been trying all sorts of ways
to come up with the code in postgresql but when I this
command:
select NewsTools.del_news('20040111DN001869');
I get this error:
ERROR: Namespace "NewsTools" does not exist

Tnx,
Darius

__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 22 '05 #1
2 1637
On Tuesday 10 February 2004 11:18, brynk wrote:
Anyone please help... I'm a newbie on creating
functions in postgresql.

Here is an oracle package that I'm trying to port to
postgresql: CREATE OR REPLACE PACKAGE BODY NewsPkg.NewsTools
We don't have packages.
PROCEDURE del_news (i_id IN VARCHAR2)
These will be functions rather than procedures.
Can anyone help me on how this oracle package would
look like in postgresql... I would really appreciate
it if someone could show me even the synopsis of this
code in postgresql. I've been trying all sorts of ways
to come up with the code in postgresql
Post one of your functions with the Oracle equivalent and someone will be able
to point out any problems.
but when I this
command:
select NewsTools.del_news('20040111DN001869');
I get this error:
ERROR: Namespace "NewsTools" does not exist


And does the namespace (i.e. schema) NewsTools exist?

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #2
On Tuesday 10 February 2004 16:48, brynk wrote:
Anyone please help... I'm a newbie on creating
functions in postgresql.

Here is an oracle package that I'm trying to port to
postgresql:

CREATE OR REPLACE PACKAGE BODY NewsPkg.NewsTools
AS
Postgresql does not have packages. However you can create the schema which
contains only functions as a satisfactory replacement of packages.

Of course some 'minor' details such as package level variables could still be
a problem..:-)

So you have to replace this create package statement with a create schema
statement.
Can anyone help me on how this oracle package would
look like in postgresql... I would really appreciate
it if someone could show me even the synopsis of this
code in postgresql. I've been trying all sorts of ways
to come up with the code in postgresql but when I this
command:
select NewsTools.del_news('20040111DN001869');
I get this error:
ERROR: Namespace "NewsTools" does not exist


Postgresql is interpreting it as a schema access. If you define schema as I
have suggested above, it should not be a problem..

HTH

Shridhar

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #3

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

Similar topics

1
by: Barry Edmund Wright | last post by:
Problem when using Xp Packaging Wizard and the database being able to find the Application Icon after database is deployed. Under Menu/Tools/Startup form I have: Application Icon:...
1
by: Coy Howe | last post by:
This one seems bizarre! We have a database consisting of a main table and 12 - 15 "sub" tables, which are connected via cascading relationships. The database performs many complex calculations...
3
by: Paul Aspinall | last post by:
Hi I want to package my C# winforms app, to be deployed with MSDE, as easily as possible for the end user. I want to create an MSI or Installshield (prefer MSI), to setup my C# app, together...
3
by: VJ | last post by:
I have a MSI that installs some Add-ins for office applications. This package was generated by the Add-in project Wizard. How do I include this project as part of the package I build for my...
2
by: Jozef | last post by:
It's possible I might have found the problem of my previous post, but I'm really not sure. My XP Packaging wizard is adding COMCAT.DLL version 4.71. My development machine uses version 5.0 and the...
0
by: blkwebman | last post by:
I'm trying to create a "standalone" install package (without any of the dialog boxes that a standard setup package would have). I think I understand how to do it in VB6 (using PDCmdLn.exe); I have...
15
by: John Nagle | last post by:
I've been installing Python and its supporting packages on a dedicated server with Fedora Core 6 for about a day now. This is a standard dedicated rackmount server in a colocation facility,...
4
by: Mr Seth T | last post by:
Hey, I have spent several days trying to find out how to do something, and i don't know if I am blind or what, but I can not find it. I am developing a web app and I need it to run an activex...
5
by: Paul Rubin | last post by:
I've been through this kind of thing a few times in the past and received excellent advice here on clpy about how to deal with specific technical aspects (e.g. how to use setuptools, InnoSetup,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
0
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...
0
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...

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.