473,395 Members | 1,468 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.

Conditional delete

Hi.

I'm new with PostgreSQL, but this thing doesn't allow me to sleep:

I wonder if it is possible to execute SQL query which:
1. checks out if table exists, and if it is:
2. deletes it
All of it at SQL query level, preferrably in one transaction.

Something like (MSSQL):
IF EXISTS (SELECT * FROM sysobjects WHERE id =
object_id(n'properties_branches') AND objectproperty(id, n'isusertable')
= 1)
DROP TABLE properties_branches

or (MySQL)
DROP TABLE IF EXISTS properties_branches;

Anyone?

Thanks. And sorry if it is a stupid question.

--
Bartosz Jakubiak
Nov 23 '05 #1
1 4730
Bartosz Jakubiak napisal(a):
I wonder if it is possible to execute SQL query which:
1. checks out if table exists, and if it is:
2. deletes it
All of it at SQL query level, preferrably in one transaction.


As far as I know it is not possible in SQL.
You have to use one of procedural languages.
For PostgreSQL 7.4 look here:
http://www.postgresql.org/docs/7.4/static/xplang.html

--
Bartosz Jakubiak
Dec 8 '05 #2

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

Similar topics

1
by: David Winter | last post by:
(Sorry - couldn't find a generic DocBook NG - I hope this is close enough.) I'm considering moving my documentation and translation business - which is currently done in proprietary formats such...
1
by: Orest Kinasevych | last post by:
Okay, I made sense of the earlier suggestions and realized I was on the right track -- I appreciate the feedback which got me to this point. The suggestions posted here indeed worked and...
28
by: Benjamin Niemann | last post by:
Hello, I've been just investigating IE conditional comments - hiding things from non-IE/Win browsers is easy, but I wanted to know, if it's possible to hide code from IE/Win browsers. I found...
3
by: David Link | last post by:
Hi All, Here's a Conditional drop_table func for those interested. There was a thread on this a long time back. We do this all the time : DELETE TABLE sales; CREATE TABLE sales (...);
3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
1
by: Dee | last post by:
I have a form displaying dealer information. It contains a subform which displays territories which they are assigned to this dealer's DealerId number in datasheet view. I have "delete" disabled...
3
by: JC | last post by:
Hi, I am using a Datagrid and populating it from a database. I have a 'delete' button column, and when click it executes the DeleteCommand event. My problem is I would like this button to...
5
by: Trapulo | last post by:
I'm using conditonal compile with statement #IF CONFIG This works if I use #IF CONFIG = "Debug" or #IF CONFIG= "Release" But if I define an other compilation profile, eg. "BestRelease", and I use...
2
by: Lyn | last post by:
Hi, Having fun trying to get Conditional Formatting working on a textbox control in a continuous form subform (Access 2003). The condition I want is when the value of the textbox is Null and/or...
1
by: Rob | last post by:
Hi, I am using a databound web control (infragistics webgrid) whose dataobject's delete row property is set to run a particular method in the Business Logic Layer. Before calling the Data Access...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.