473,395 Members | 1,679 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,395 software developers and data experts.

DB2 Questions

1- Does DB2 have Extended Properties for objects like MS SQL has?
Any idea if it exists in Oracle?

2- Oracle has CREATE OR REPLACE PROCEDURE, is there
an equivalent in DB2?

I would like to know if it's simple to add a condition to delete before
the creation of a function or a stored procedure. For example in
Microsoft SQL the code below will check and drop the stored
procedure procTEST if it exists.

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[procTEST]') and
OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[procTEST]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

CREATE PROCEDURE dbo.procTEST
@ID INTEGER
AS
DELETE
FROM TableTEST
WHERE ID = @ID

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
3- On the same topic what is the proper code to write an ALTER
PROCEDURE? For example if i want to Alter the above
procTest procedure by changing the
WHERE ID = @ID
to
WHERE ID = 1

I am getting an error why i simply change the word CREATE to
ALTER and try to execute the code.
4- In MS SQL there is no PACKAGE like i see DB2 and ORACLE have.
What is it and how would i know if i need to use it when i am converting
MS SQL procedures to DB2?
Thank you

Nov 12 '05 #1
1 2886
serge wrote:
1- Does DB2 have Extended Properties for objects like MS SQL has?
Any idea if it exists in Oracle? DB2 supports distinct types (liek typedef in C) and structured types
(classes). Structured types are not common outside the world of extenders.
DB2 does not have "constraints" on types if that is what you mean.
To do that you could use distinct types and overload the cast functions.

2- Oracle has CREATE OR REPLACE PROCEDURE, is there
an equivalent in DB2? DROP PROCEDURE followed by CREATE PROCEDURE ;-)
I would like to know if it's simple to add a condition to delete before
the creation of a function or a stored procedure. For example in
Microsoft SQL the code below will check and drop the stored
procedure procTEST if it exists.

if exists (select * from dbo.sysobjects where id =
object_id(N'[dbo].[procTEST]') and
OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[procTEST]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

CREATE PROCEDURE dbo.procTEST
@ID INTEGER
AS
DELETE
FROM TableTEST
WHERE ID = @ID

GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO Works the same in DB2. The catalob view is SYSCAT.ROUTINES.
But why do the work to begin with.
I would simply do the DROP and catch the error. A lot less congested. :-)
3- On the same topic what is the proper code to write an ALTER
PROCEDURE? For example if i want to Alter the above
procTest procedure by changing the
WHERE ID = @ID
to
WHERE ID = 1

I am getting an error why i simply change the word CREATE to
ALTER and try to execute the code. DB2 supports ALTER PROCEDURE only to change properties, not the body.
See CREATE OR REPLACE above.
4- In MS SQL there is no PACKAGE like i see DB2 and ORACLE have.
What is it and how would i know if i need to use it when i am converting
MS SQL procedures to DB2?

A PACKAGE in DB2 and Oracle are two very different concepts.
In Oracle a package could loosely be compared to a "library".
Multiple routines get "packaged together". Mostly this is useful to
share global variables and state in general - I guess.

In DB2 a package is the collection of compiled plans for all the
statements in a file (e.g. a C-application file with embedded SQL).
If you use SQL Procedures, which I presume, you don't have to worry
about them.

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2

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

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
1
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...

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.