Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > Database & Database Programming

Database & Database Programming MySQL, Oracle, SQL, PL/SQL, ABAP, Smart Forms, and other databases and languages. A database is an organized body of related information used in many websites (including CC).

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-17-2008, 12:02 PM
polisasimo polisasimo is offline
Newbie
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0
polisasimo is on a distinguished road
Default New to SQL question

Hello Everyone,

I am new to the forum and a bit wet behind the ears when it comes to SQL programming Below is a sample script I have generated and I am looking for some constructive criticism on the code.
SQL Code:
  1. UPDATE ODB.PN_INVENTORY_DETAIL
  2. SET PHYSICAL_COUNT_DATE = to_date('15-JAN-2007','dd-MON-yyyy')
  3. WHERE ((
  4.     (ODB.PN_MASTER.CATEGORY = 'EXP') OR
  5.     (ODB.PN_MASTER.CATEGORY = 'EXP B737') OR
  6.     (ODB.PN_MASTER.CATEGORY = 'EXPB727')
  7.       ) AND (ODB.PN_INVENTORY_DETAIL.BIN >= '1' AND ODB.PN_INVENTORY_DETAIL.BIN <= '10'))

In addition to any criticism I also have a quick question. As seen above my intentions are to set the value of the PHYSICAL_COUNT_DATE field = to a given date based on a few conditional clauses. Lets say I had 100 total "ODB"."PN_INVENTORY_DETAIL"."BIN" values and wanted to set the PHYSICAL_COUNT_DATE by incriments of 30 days on 10 percent of the bins at a time. Is it possible using SQL to loop the above code to incriment the date and bin values by 30 days and 10 bins at a time. I was thinking something like reading the date and bin value from a txt file and looping until the end of file.

Thanks for your time in reading and posting in advance.

Last edited by polisasimo; 01-17-2008 at 12:47 PM. Reason: removed " " from objects for readability and added the to_date function.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 01-17-2008, 01:04 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,275
Last Blog:
wxWidgets is NOT code ...
Rep Power: 36
WingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to allWingedPanther is a name known to all
Default

One observation is that it appears that ODB.PN_INVENTORY_DETAIL.BIN contains numeric data, but you are doing a string comparison. That seems likely to give interesting results if your DB platform doesn't support automatic conversions or does the wrong type of conversion. For example, '2' > '10', even though 2 < 10.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-17-2008, 01:15 PM
polisasimo polisasimo is offline
Newbie
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0
polisasimo is on a distinguished road
Default Thanks

Panther,

Thanks for the input, it is much appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a script vulnerable to SQL injection? shibbythestoner PHP Forum 7 12-15-2007 09:56 PM
Best program for SQL database manipulation Rhadamanthys Database & Database Programming 3 07-02-2007 03:32 PM
Executing SQL Server 2k DTS Package via Visual Basic Joemama Visual Basic Programming 0 04-09-2007 07:21 PM
Question: free webhosting with PHP, SMTP, and at least one SQL database skilletsteve Hosting and Registrars 5 12-08-2006 05:36 AM
Oracle has more Flaws than MS SQL? Jordan Database & Database Programming 9 12-05-2006 10:39 AM


All times are GMT -5. The time now is 11:27 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 97%

Ads