Home » SQL & PL/SQL » SQL & PL/SQL » Please help me............(do you like my stupid unhelpful title?)
Please help me............(do you like my stupid unhelpful title?) [message #261915] Fri, 24 August 2007 01:12 Go to next message
raja_grk
Messages: 5
Registered: August 2007
Junior Member
I have one requirement

I want a procedure for if i give User parameters as input Clinic_id ,DOctor_id ,sysdate.

SO we have create 12 tables, with table name like
EMR_001_005_AUG_2007.

Where 001 is the clinic id ,
005 is the doctor id,
AUG is the starting month and 2007 is the current year.

It should create the 12 tables till JUL OF 2008 .
i.e. EMR_001_005_AUG_2007 to EMR_001_005_jul_2008.
with default values of 'N'.

[Updated on: Fri, 24 August 2007 07:58] by Moderator

Report message to a moderator

Re: Please help me............ [message #261919 is a reply to message #261915] Fri, 24 August 2007 01:15 Go to previous messageGo to next message
BlackSwan
Messages: 25050
Registered: January 2009
Location: SoCal
Senior Member
HUH?
Did you read & try to follow posting guidelines in STICKY post at top ofoforum?
Re: Please help me............ [message #261922 is a reply to message #261915] Fri, 24 August 2007 01:21 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
In addition what a bad design! One table per clinic, doctor and month!!!
Why not one table per row?

Regards
Michel
Re: Please help me............ [message #261932 is a reply to message #261922] Fri, 24 August 2007 01:48 Go to previous messageGo to next message
raja_grk
Messages: 5
Registered: August 2007
Junior Member
Hi Michel,

They asked to put all these coloumns in one table .

Give me a suggestion how to implement logic for this procedure......


Thanks & Regards
Raju
Re: Please help me............ [message #261936 is a reply to message #261932] Fri, 24 August 2007 01:55 Go to previous messageGo to next message
Michel Cadot
Messages: 64152
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Columns or tables? Your 2 posts are in contradiction.

Regards
Michel
Re: Please help me............ [message #261946 is a reply to message #261936] Fri, 24 August 2007 02:33 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
As has been mentioned, having multiple tables like this is a REALLY REALLY REALLY bad idea.

There is absolutely no need for multiple tables like this. This solution adds NOTHING to the functionality that your code can achieve, and will make a lot of things much more difficult.

I'm repeating myself here, but I want to make sure you know that you're current design needs to be scrapped.

You should replace this with a single table like this:
CREATE TABLE emr
(clinic_id     varchar2(3)
,doctor_id     varchar2(3)
,start_Date    date
,.....
where .... indicates all the other fields you would have put into the table.

You do not need to write a procedure to create this table - just create it vwith SQL and you're done.
Previous Topic: PL/SQL Procedure
Next Topic: Invalid character error
Goto Forum:
  


Current Time: Sat Dec 10 14:57:15 CST 2016

Total time taken to generate the page: 0.07916 seconds