Is varchar2(9) or even number(9) bad as a ssn?
Hi All,
I just want to question the wisdom of (<INT>) datatypes.
If I do ...
create table table_0123 (
ssn varchar2(9),
... in tons of tons code (or even in a small piece of code
that gets used or modified over and over), won't I be setting
my self up for a Y2K like problem if there is ever more than
999,999,999 people with SSN's? What is that ... 1 billion people?
How many people are in the world?
wouldn't ...
create table table_0123 (
ssn number,
be better?
Thanks
So you're compiling a database that holds details of everybody in the whole world? Spooky. Still you've come to the right place: Oracle started out as a CIA project.
Datatype for SSN: hmmm. I'm not American, so I'm not familiar with your system. On this side of the pond our SSN equivalents (NIN) are of the format AA999999A, which gives us 17,575,982,424 combinations (or thereabouts, I don't know if there are any excluded characters). This is sufficient for a few centuries of UK existence, but not very good for the whole world. But, given an alphanumeric format, VARCHAR2(9) is the only viable definition.
If you have a purely numeric SSN then NUMBER is a goer. Please do not choose VARCHAR2(9) for a purely numeric field - I have a (third party) legacy system here that has that combination for the primary key of the most referenced table, which means having to LPAD everything with zeroes. Nightmare.The choic
As the following test shows, all NUMBER fields take up the same about of space so there are no storage implications for you. The choice is merely a question of the amount of metadata you wish to build into your system.
When you acheive world domination can I be your cackling, hunchbacked sidekick?
Cheers, APC
SQL> create table num_tst (col1 number(9,0), col2 number(38,0), col3 number);
Table created.
SQL> select column_name, data_length, data_precision, data_scale
2 from user_tab_columns
3 where table_name = 'NUM_TST';
COLUMN_NAME DATA_LENGTH DATA_PRECISION DATA_SCALE
COL1 22 9 0
COL2 22 38 0
COL3 22
SQL>
Similar Messages
-
How to find the largest odd number and smallest even number from an array
Hello All
I want to find out largest odd number and the smallest even number from an arry numbers? What is the best method to achieve this.
Thanks
SravzYou need to sit down and figure out an algo on how you would do it if you had to do the same thing from a blind container perspective:
1 - collect all the items you want to look at
2 - look at an item
3 - is it odd?
4 - if it is odd then check if it is larger than previously largest number
5 - save it if it is larger
6 - return back to 2 unless no more items
7 - item is not odd so it must be even--is it smaller than previous
8 - save it if it is smaller
9 - return back to 2 unless no more items
Now you just need to know how to check if something is even or odd: to do this you will need the modulous operator--integer division.
Note: this all assumes that your needs are for integer type of numbers, otherwise there is not enough information to define an answer. For instance, if you are using floats at 0.5--it that even or odd? Do you consider an err factor when dealing with floats? etc... -
FINDING MEDIAN FOR AN ARRAY OF INTS WITH EVEN NUMBER OF VALUES
okie dokie fellas i know this has got to be easy but i hjave been sittin at my comp forever workin on projects that are due and my head isn't all there anymore...could someone please clue me in on how im supposed to write the logic to find the median of an array of integers if the array contains an even number of values...I know I have to average the 2 values on either side but i cant figure it out at all...sorry i know its dumb but thnaks to anyone who helps
package pgm3deClercqMatt;
* @author Owner
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.text.*;
public class ExamStatistics
public static void main(String[] args)
DbConnection db = new DbConnection("pgm3");
boolean moreRecords;
String query = "SELECT * FROM pgm3Data ORDER BY ExamGrade";
ResultSet rs = db.processQuery(query);
int nbrGrades = 0;
ResultSetMetaData rsmd = null;
try
rsmd = rs.getMetaData();
catch(SQLException sqlex)
JOptionPane.showMessageDialog(null, "SQLException getting ResultSet data or metadata");
System.exit(0);
int s[] = new int[200];
DecimalFormat decimal = new DecimalFormat("#,##0.00");
int n = 0, aboveNinety = 0, numberAboveNinety = 0;
double sum = 0, avgGrade = 0, medianGrade = 0;
try
moreRecords = rs.next();
if(!moreRecords)
JOptionPane.showMessageDialog(null, "pgm3Data Result Set is Empty.");
System.exit(0);
while(moreRecords)
s[n] = rs.getInt(1);
n++;
moreRecords = rs.next();
}// end of while loop
System.out.println("n = " + n);
System.out.println("s[0]= " + s[0]);
System.out.println("s[n-1]= " + s[n-1]);
//FIND AVERAGE OF ARRAY
for(int j=0; j<n; ++j)
sum += s[j];
avgGrade = sum/n;
//FIND NUMBER OF GRADES ABOVE OR EQUAL TO 90
for(int j=0; j<n; ++j)
if(s[j]>=90)
numberAboveNinety++;
//FIND MEDIAN EXAM GRADE
for(int j=0; j<n ; ++j)
if(Math.abs(medianGrade - Math.floor(medianGrade))<1.e-10)
medianGrade = s[(j+1)/2];
else
medianGrade = <HERE IS WHERE THE PROB IS
}// end of try block
catch(SQLException sqlex)
JOptionPane.showMessageDialog(null, " SQLException getting ResultSet data or metadata");
System.exit(0);
String output = "";
output = "Number of Exam Grades: " + n;
output += "\nHighest Exam Grade: " + maxOfArray(s, n) + "\nLowest Exam Grade: " + minOfArray(s, n)
+ "\nAverage Grade: " + decimal.format(avgGrade) + "\nNumber of exam grades above 90: "
+ numberAboveNinety + "\nMedian Exam Grade: " + medianGrade;
JOptionPane.showMessageDialog(null, output);
System.exit(0);
}// end of main
static int maxOfArray(int z[], int n)
int j, max = z[0];
for(j=1; j<n; ++j)
if(z[j]>max)
max = z[j];
return max;
static int minOfArray(int z[], int n)
int j, min = z[0];
for(j=1; j<n; ++j)
if(z[j]<min)
min = z[j];
return min;
}// end of ExamStatistics
class DbConnection
// class DbConnection creates and manages the db connection,
// processes queries, and returns result sets for processing
private Connection connection = null;
private String url="jdbc:odbc:";
private Statement statement;
private String username = "";
private String password = "";
private ResultSet rs;
private int nbrResultSets = 0;
// Constructor Argument is the registered name of the database
DbConnection(String dbName)
try
{// load driver to allow connection to database
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection ((url+dbName), username, password );
catch (ClassNotFoundException cnfex)
fatalError("ClassNotFoundException on connection attempt");
System.exit(0);
catch (SQLException sqlex )
fatalError("SQLException -- Unable to Connect to db");
System.exit(0);
} // end of constructor
ResultSet processQuery(String query)
// process a single SQL query and return the resulting data set
rs = null;
try
statement = connection.createStatement();
rs = statement.executeQuery(query);
catch (SQLException sqlex)
fatalError("SQLException on query or processing");
return rs;
void endConnection()
try
connection.close();
catch (SQLException e)
fatalError("SQLException on attempt to close connection");
// simple local fatal error handler
private void fatalError(String msg)
JOptionPane.showMessageDialog(null,msg);
System.exit(0);
} // end of class DbConnectionsorry to anyone who thinks what i'm doing is a joke
first of all i'm a student and secondly i'm taking
java in a summer session so things don't get
explained as well as they should. And how is this our problem?
I'm doing the best
i can. The for loop was because the array that I
defined to hold 200 values was being filled by a
database with a supposed unknown number of values but
less than 200 so i waslooping through to get each
value and put it in order and the conditional
statement was supposed to test to see if the incoming
median was an integer and was in the final write-up
put into it's own boolean method returning false if
there was no median and you needed to take the
average of the next lowest and highest values. BThere's always a median. The definition I sent you tells you what it is.
But
thnak you very much to the people that actually help
on here and don't try to bash people who have put
effort into writing their code, however shitty it may
look to them. You can't control what people say about your stuff. Everyone who criticizes your work isn't making a personal attack. They're telling you something that you should be learning from. Your problem is that you can't separate yourself from your work.
No one knows absolutely everything and
people who decide to talk down on others when they
are using this forum as a last resort need to grow
up.Grow up? That's what you need to do. If you think for a moment that you'll never be criticized once you leave that ivory tower you're sadly mistaken. You need to figure out how to separate yourself from your code.
% -
"generate subset" in script gives error if even number
I am try to generate with a scipt using a PXI6551. In the generate subset command if it is a EVEN number such as below (gree) subset(0,17) it gives the error below (red). If it is an ODD number it works. Is this a bug, normally you would need an even number of samples to be able to generate but with the script it seems to give the error if there is an even number?
Thanks,
Brian
script myScript
repeat 1
Generate PRBS
end repeat
Generate PRBS subset(0,17) <-gives error (0,18) does not give error
script
Error -1074115617 occurred at niHSDIO Write Script.vi
Possible reason(s):
Driver Status: (Hex 0xBFFA4BDF) DAQmx Error -200032 occurred:
Subset length specified is not valid.
Change the subset length to be longer than zero samples and a multiple of the alignment quantum.
Line Number: 5
Position in Line: 18
Subset Length: 17
Alignment Quantum: 2
Status Code: -200032
Message Edited by BrianPack on 09-29-2005 04:29 PMBrian,
The format (x,y) means y samples starting at position X and therefore when you specify (0,17) you would still generate 17 samples but starting at position 0. Whereas when specifying (1,17) you would generate STILL 17 samples but starting at position 1. Therefore, in either case, you are still asking to generate an odd number of samples. Hope this helps.
Ayman K -
Magic number mismatch: bad mzip file in 3750 stack switch
Hi All can anybody help me in this error msg
"magic number mismatch: bad mzip file"
I am trying to upgrade the switch with"c3750e-ipbasek9-tar.122-55.SE5.tar" in 3750 stack switch it is showing this error msg while booting
thanks in advanceHi,
The reason you are getting this error message on the switch is a corrupt or wrong IOS image "c3750e-ipbasek9-tar.122-55.SE5.tar".
If the switch is in rommon mode, and you have any other image in the switch, boot it using that image. Once the switch is up, download and copy the correct IOS image once again on the switch and try to upgrade.
If you need help in finding the correct IOS image, give me the exact switch model number, i will help you with that.
But forsure the image is wrong or corrupt and that is why you are getting this error.
Thanks
Ankur
"Please rate the post if found useful" -
Write a program that is supposed to read 500 integers from user. Use a break statement to stop the reading if any negative even number is entered. Display that number
Can anyone write the pseudocode for this question?
The thing that bothers me is that a negative even number, How do I write the code to stop this one?
Can anyone also write the computation part? I'd do the remaining whole body. Thank you ( Just a rough figure will help a lot ) Thanksxcoder wrote:
Write a program that is supposed to read 500 integers from user. Use a break statement to stop the reading if any negative even number is entered. Display that number
Can anyone write the pseudocode for this question?
The thing that bothers me is that a negative even number, How do I write the code to stop this one?
Can anyone also write the computation part? I'd do the remaining whole body. Thank you ( Just a rough figure will help a lot ) Thanks
pseudo code:
read 500 integers
if less than 0 and even
display number
stopto check if negative:
if(myNumber<0){do something here}to check if even:
myTest = myInt/2;
if(myInt == (myTest*2)){do something here}BTW: there are other ways of doing this, but you should have been able to at least think of this one. -
Text (varchar2(320)) to a number
Hi,
May I know how to convert text (varchar2(350)) to a number in an sql...?You could use the TO_NUMBER function.
If that's not what you need please explain clearly by providing an example. -
Get Invoice number in BADI INVOICE_UPDATE
Hi all.
It`s posible to get a invoice number in badi invoice_update. I create invoice in tc MIRO. I create my implementation and i call my function group (here i need number just creating invoice)
Thx
GrzegorzHI,
Check the methods parameters for CHANGE_AT_SAVE method: S_RBKP_NEW or S_RBKP_OLD.
S_RBKP_NEW-BELNR will ahve the document number.
Regards,
Ravi -
Create function for ODD or EVEN(NUMBER) in pls sql
create function for ODD or EVEN(NUMBER) also
if number is odd multiply by 5
if number is even multiply by 10;865253 wrote:
create function for ODD or EVEN(NUMBER) also
if number is odd multiply by 5
if number is even multiply by 10;
create function fn_get_no (n_in in number) return number is
o_num number;
begin
if mod(n_in,2) = 0 then
o_num := n_in*10;
else
o_num := n_in*5;
end if;
return o_num;
end;
select fn_get_no(5) odd, fn_get_no(4) even from dual;
ODD EVEN
25 40 Vivek L -
Regex: check string for even number of a symbol
Hi,
for example "ass'asd'asd" is valid, but "asd'asd'asd'asd" is not, for symbol " ' ". I have tried every combination of \w, [...],',+ and nothing...
Ideas?what is doing the %2 here, prome' ?If there are an even number of char symbol in String s, then s.length() - s.replace(""+symbol, "").length() will also be even. So that number mod 2 will equal zero (and return true).
-
Hi All,
MAXDOP Setting with an EVEN number will outperform ODD number. If any of you have any data points, please share.
NASTY RUMORS ABOUT MAXDOPI do not think there is any relations between specifying even and odd numbers in MAXDOP... What are you trying to achieve?
http://sqlblog.com/blogs/adam_machanic/archive/2010/05/28/sql-university-parallelism-week-part-3-settings-and-options.aspx
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Odd even number and Boolean indicator
Hi all,
For example, I have these numbers from 0 to 112233. It will start counting from 0 and shown it on an output indicator. When it is even number (0,2 or 4,...) the Boolean indicator will become false, but when it is odd number (1,3 or,...) the Boolean indicator will become true.
I'd like to ask if it is possible to detect the values changing in output indicator when it start counting numbers from 0, and then the Boolean indicator will become false or true depending on even or odd number shown on an output indicator? How can I do that?
Thank you!johnsold wrote:
It may not be that much faster. In the little test VI Q&R takes 581 ms for 10^8 iterations while AND takes 503 ms. That is 78 ps difference. Hardly enough time for a coffee break. Unless you drink really fast.
Yes, both are "fast enough" for all practical purpose. Even thought they are nealy identical in speed, the Q&R shows more variability in execution time (10% variability), while the AND is singificantly more stable (>1% variability).
(Make sure you disable debugging for a 10x speedup overall)
It also seems that the AND code folds better. If we change the control to a diagram constant, the AND version speeds up by a factor of two, even though no folding is shown anywhere inside the sequence structure. I have no idea what that means.
LabVIEW Champion . Do more with less code and in less time . -
HT1349 my iphone imei number is bad
my iphone imei number is bad is there a way to bypass this or next question is there a way to set iphone with out active sim card
No. If they can't recover it at https://iforgot.apple.com it's useless. It's likely the phone is stolen.
-
How to Purchase Order number in badi ME_PROCESS_PO_CUST~INITIALIZE
Hi SDNers,
I have problem to get purchase order number in badi ME_PROCESS_PO_CUST method INITIALIZE, when purchase order release from ME28 tcode.Hi Suresh,
I just tried that ... it is working fine... You have to use CMOD to implement it by creating a project...
Please documentation on how to implement user exits...
Also Please understand this is a Workflow forum... please do not post ABAP queries here... You would get better answers if you post in ABAP forums...
Regards
Gautam -
In this blog post here:
/people/david.halitsky/blog/2007/03/08/the-astrobiology-of-enterprise-soa-how-planet-abap-can-seed-life-on-planet-bpx
I gave a schematic outline of the badi's and exits required to customize SAP QM in a particular way.
Up until recently, it was thought that we only had to use these badi's and exits
to update QALS records in order to link an inspection lot to an inspection plan that is not the one that standard SAP logic picks.
But it turns out that we not only have to update QALS in this way, but also delete SAP-added records from AFFL, AFVC, AFVU, and AFVV and re-add our own corresponding to the operations in the non-standard plan we're selecting for the inspection lot.
OK - so we know exactly how to do these deletes and re-adds, because the way SAP does the original inserts into AFFL/AFVC/AFVU/AVFF (during a MIGO goods receipt post) is perfectly clear - the sequence of FMs and forms is:
FM's:
qeev_tables_generate
qpap_plan_read
qpap_post_qapo
co_bt_order_post_qm
co_vb_order_post
FORMs performed from co_vb_order_post:
affl post
afvg_post (takes care of afvc, afvv, afvu)
But even though we know what we're doing, and even though we can do everythign we need to do with an SAP-delivered BAdI or exit, maybe what we're doing is still too dangerous because we're relying on SAP keeping a number of different files interrelated in exactly the way they are now:
QALS
MAPL
PLKO
PLFL
PLAS
PLPO
AFVC
AFVV
AFVU
AFFL
What do you think ?
Thanks in advance for whatever time you can afford to spend considering this matter ...
djhHi Stephen -
I appreciate the responses from you and Chris very much, because my current customer is right now grappling with the question of whether what we "need" to do is actually too much dangerous over-customization. So this is not a discussion in the usual "theoretical vacuum".
I want to explain why I think the "direct update" rule here MAY not apply in this particular case.
But before I do, I want to make very clear that I was the one who brought this situation to management attention when it turned out that NINE core SAP tables were involved, not just ONE. So whereas I felt more or less comfortable with one update to one table to repoint an inspection lot to a different inspection plan than the one which SAP selects, I didn't feel at all comfortable with direct updates to eight other core tables, particular when these involve what amount to "key field updates" - effectively, "deletes/re-adds".
That being said, the details of this particular case involve the fact that when we go for the eight core SAP tables, we are not doing anything other than doing exactly what SAP does, but with different "ALLOWABLE" choices. There are SAP delivered transactions which allow a customer to choose the inspection plan that will be associated with a given inspection lot. These transactions record the customer's choice in two different ways: 1) first - in the relationships among the rows of PLKO, PLAS, PLFL, PLPO; 2) second - in the relationships among the rows of AFFL, AFVC, AFVV, and AFVU. So what we're doing in the exits/BAdI's is:
1) undoing the choice of inspection plan that SAP has made and recorded in these tables;
2) recording our "custom" choice of inspection plan in these tables.
For this reason, it is difficult to BLINDLY apply the "don't do direct updates" and "don't do something SAP doesn't anticipate you doing" rules. Because on the one hand, it is true that SAP does not specifcally say in the BAdI documentation or exit parameters: "use this exit to change choice of inspection plan" or "use this BAdI to change choice of inspection plan". But on the other hand, we are not using the exits/BAdI's to do anything different than SAP already does when MIGO GR posting triggers inspection lot creation and inspection plan assignment.
With respect to the "watch-out for problems during upgrade" rule of thumb, it is also difficult to apply this rule blindly because it turns out that in our case, all the columns in the relevant tables are KEY columns. And for that reason, it is hard to imagine SAP changing its fundamental "E-R diagram" for QM during the course of any future upgrade. And if this possibility is, in fact, remote (i.e. if SAP cannot really change the "E-R" key columns of QM tables without rewriting QM from scratch), then the "upgrade problem" issue really doesn't arise.
Anyway, I want to close this post by saying that the functional analysts who proposed the customization in the first-place do NOT think that direct updates of nine core SAP tables is overly dangerous, and this is why management has to make a difficult decision between what the functional consultants are saying and what the in-house development lead is saying.
As a consulting developer, my job (fortunately!) is to collect the relevant facts and present a clear picture to the development lead, so that he or she can in turn present a clear picture to management.
It will be interesting to see the eventual outcome of this situation, and I will of course report this outcome back to this thread.
And again, thanks very much for taking the time to respond.
djh
Maybe you are looking for
-
Query Parameter Data Type error betwee IE6 and IE7
Hello all. This is a strange one. Using MII v12. When setting parameters for a SQL query from Javascript, the query executes properly on IE7 but generates errors on IE6. The errors are JDBC errors having to do with "Conversion failed when converting
-
Help if anyone can PageTurning effect
I am using some code to creat the page turning effect, which works quite nicely to turn pages. But it only turns pages from right to left and I would like the option of going left to right. The code or file i used is from: http://www.oreillynet.com/p
-
I am getting the message error when trying to run the labwindowa/CVI adapters for debug
See attachments for error message and teststand settings. I am running testand 4.0.1 It was working before and suddenly it crash and then I am getting that error message every time Regards Attachments: ErrorLoadCallback.jpg 32 KB ErrorLoadCallback2.
-
How to reset drive (when belonging to unknow RAID-set)?
Hi, I switched 7 drives from XRaid to another and when trying to create a new array to the switched drives TWO of them shows as yellow and saying that they already belong to a RAID set. I deleted the old array before the switch. So any advice how to
-
Sharing with those have wifi problem
My 4s got wifi problem a few days after updated to 702 from 613. It couldn't find wifi. I ve done followings and my wifi is back. Turn iphone off, Put iPhone in a seal plastic bag and put into refrigerator for 10min. Then turn on, set it into airplan