How to insert deliberately incorrect data in a table for the test?

Good morning (or afternoon you BluShadow) :),.

I tried my hand to solve the problem that is mentioned in this thread

Invalid number exception

where the OP has incorrect data in a numeric field.

When I tried to create a test case (which requires the insertion of incorrect data in a numeric field), Oracle fought me teeth and nails and won. I could not put incorrect data in a numeric field.

Question is: How do we convince Oracle to allow me to "ZZZ" in a numeric field?

By the way, what I was trying to solve the problem in the above thread, was to throw the digital field with incorrect data in a string type (Char (20), for instance) and then inspect the string to determine if it is a valid number.

This approach has the potential if Oracle will not validate the contents of the field before castant. If that's the case then it will not work. That of what I tried to test but could not get the test data with.

Thank you for your help,

John.

Question is: How do we convince Oracle to allow me to "ZZZ" in a numeric field?

You can not.

I look more deeply in the other thread that you mentioned, but this is probably a question like this:

Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 

SQL> create table table1 (
  2   num number(5),
  3   des1 varchar2(10)
  4  );

Table created
SQL> create table table2 (
  2   num varchar2(5),
  3   des2 varchar2(10)
  4  );

Table created
SQL> insert into table1 values(1, 'desc1');

1 row inserted
SQL> insert into table1 values(2, 'desc2');

1 row inserted
SQL> insert into table2 values('1', 'desc1');

1 row inserted
SQL> insert into table2 values('2', 'desc2');

1 row inserted
SQL> insert into table2 values('A', 'desc3');

1 row inserted

SQL> select *
  2  from table1 t1
  3       join table2 t2 on t2.num = t1.num
  4  ;

select *
from table1 t1
     join table2 t2 on t2.num = t1.num

ORA-01722: Nombre non valide

SQL> select *
  2  from table1 t1
  3       join table2 t2 on t2.num = to_char(t1.num)
  4  ;

   NUM DES1       NUM   DES2
------ ---------- ----- ----------
     1 desc1      1     desc1
     2 desc2      2     desc2
 

We can see what is happening behind the scene by running a plan to explain:

SQL> explain plan for
  2  select *
  3  from table1 t1
  4       join table2 t2 on t2.num = t1.num
  5  ;

Explained

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
--------------------------------------------------------------------------------
Plan hash value: 4277839568
-----------------------------------------------------------------------------
| Id  | Operation          | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |        |     3 |    93 |     7  (15)| 00:00:01 |
|*  1 |  HASH JOIN         |        |     3 |    93 |     7  (15)| 00:00:01 |
|   2 |   TABLE ACCESS FULL| TABLE1 |     2 |    40 |     3   (0)| 00:00:01 |
|   3 |   TABLE ACCESS FULL| TABLE2 |     3 |    33 |     3   (0)| 00:00:01 |
-----------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
   1 - access("T1"."NUM"=TO_NUMBER("T2"."NUM"))
Note
-----
   - dynamic sampling used for this statement

19 rows selected
 

The predicate of access actually includes a TO_NUMBER, which of course not on NUM = "A".

Published by: odie_63 on 24 July. 2010 12:39

Tags: Database

Similar Questions

  • How to use several adf 12 shape and insert the form data in to table during the click on "submit" button

    How to use several adf 12 shape and insert the form data in to table during the click on "submit" button. Can we use several form from adf or not?

    Make sure that you dragged the VO based EO.

    Also make sure that the VO attributes based EO Updatable property.

    The query according to VO is used only to add LOV to the column of the original VO ModelId.

    See you soon

    AJ

  • My ipad is disabled. How to activate ipad without data loss? I know the password

    My ipad is disabled. How to activate ipad without data loss? I know the password

    You can not. If you know the password, how the iPad become disabled? If the device is disabled, the content is not already available. The only way to recover the device is to restore. You can restore your last backup after that. Follow the instructions in this document support. If you have forgotten the password for your iPad, iPhone or iPod touch, or your device is disabled - Apple supports

  • How to get the last date of 3 days for the current month?

    Hello. Guy

    How to get the last date of 3 days for the current month?

    MY OUTPUT WOULD LOOK LIKE THIS

    JANUARY 29, 2016

    JANUARY 30, 2016

    JANUARY 31, 2016


    GUYS HELP ME / / /...

    SQL > select last_day (sysdate) - level + 1 double connect by level<= 3="" order="" by="">

    LAST_DAY)

    ---------

    29 JANUARY 16

    30 JANUARY 16

    31 JANUARY 16

  • How I find myself with two passwords to iCloud for the same account?

    How I find myself with two passwords to iCloud for the same account?

    For security reasons, I only use iCloud for Contacts and "find my iPhone".

    Several months ago Apple forced me to change my password to iCloud.  So I did this.   In the last months, I used successfully the new password to 10 or 12 times when asked without problem.

    However, I received a notification of a software update for my Apple Watch. I did the update without problem. However, after completing the update my iPhone asked me to connect to my iCloud account. When I did this, she rejected my password. I made 4 attempts typing very slowly and with care for you sure I did it right.

    Then, operating under a hunch, I decided to enter my old password to iCloud. It worked?  I'm confused about this, any ideas would be appreciated.

    I had a similar problem last year. I had to call Apple. Contact is a bottom of this page.

  • How can I make a cell formula will apply for the entire column? For example D2 appears B2 - C2. How can I copy this formula for each cell in the column?

    How can I make a cell formula will apply for the entire column? For example D2 appears B2 - C2. How can I copy this formula for each cell in the column?

    If you want the formula is the same (B2 - C2) in the cell of each column you must change it as ($B$ - 2$ C$ 2). Then copy it, select the whole column and paste.

  • How can I change my mood Message in Skype for the Web?

    How can I change my mood message in Skype for the Web?

    People of good news: you can now change your mood message in Skype for the Web

    Just click on the picture at the top left of your profile, and then click the small icon of pencil next to the message of change in activity.

  • How can I get a replacement adapter to recharge for the pencil of Apple?

    I've already lost my charger. How can I get a replacement adapter to recharge for the pencil of Apple?

    If you have lost, you have to pay for a new.

  • How to buy only a few songs, without registering for the new service? It seems compulsory now, and I DON'T want TO.

    How to buy only a few songs, without registering for the new service? It seems compulsory now, and I DON'T want TO. Could someone tell me just for the selection of the menu where I can search for a song by keyword and buy it?

    If it's on your iPad, then go to the app Store in iTunes, you can buy music from there

    If you do not want to use Apple music then turn it off on your iPad via the settings > music > Music Show Apple 'off '.

  • How can I fix lines horizontal randomly and glitter for the LCD screens for HP Pavilion dv5 Vista?

    How can I correct random lines horizontal and glitter for the LCD screens for windows vista HP Pavilion dv5? Only, it happens randomly and can get all a few minutes at a time every few hours. The entire screen white and black and horizontal lines will appear during the flickering on the half top of the screen only. Nothing else changes. My sound is immutable, and none of my screens change the size or location. However, they may appear up and down during the flashing. Can someone give me an idea of what is wrong? I looked on Google for possible corrections, but most of them seem to be for refresh rate and I don't have a notch for this and can't change it according to the steps they offer.

    Read my initial response on what it takes to please.

    "See if this helps you:

    These lines indicate corruption graphics driver or lack of graphic material.

    Go to the HP Web site > Search a drivers and download article > search your laptop model number > your operating system > drivers for it: either video / graphic / Chipset (according to the wording it) > download and install the drivers.

    http://WWW8.HP.com/us/en/support-drivers.html

    If that fixed it, it seems to me be a problem of graphic material.

    Because it's a laptop; If under warranty, contact HP.

    If is not under warranty, contact a repair shop, local. »

    See you soon.

  • How can I add "Shut down" as an option for the action of the Power button if it is not available

    How can I add "Shut down" as an option for the action of the Power button if it is not available.

    Hello

    Welcome to the Microsoft Community and thanks for posting the question. Looks like you want to add shut down as an option for the power button.

    Visit this link and try the steps mentioned:

    There are two ways to change what happens when you press the power button on your computer. You can change what happens when you press the power button on your computer case (or the edge of your laptop) and you can change what happens when you press the close button in the start menu.

    Change what happens when you press the power button on your computer

    http://Windows.Microsoft.com/en-us/Windows7/change-what-happens-when-you-press-the-power-button-on-your-computer

    Hope this information helps. If you have questions to answer us and we will be happy to help you.

  • Please how can I use a value in a table of the adf in an actionListener to a button I created in a popup and thanks

    Please how can I use a value in a table of the adf in an actionListener to a button I created in a popup and thanks

    What is your version of JDev?

    Actually your question is not clear to me, but as I understand, it is you the table in the page and you have popup inside this popup you have the button you need when you click on the button to read the value of the selected table row. In the listener action button, so if you can get the current row of the table and after that you can get any attribute of the line as:

    DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("TableIteratorName"); // from pageDef.
    Row r = iter.getCurrentRow();
    Object value1 = r.getAttribute("attribute1");
    Object value2 = r.getAttribute("attribute2");
    
  • Hi, I have to Malaysia, I'm trying to load down the lightroom and cc photo shop trial for the test. but after installation I know is English version! for me, I want to use the version Chinese, how can I change the version English version Chinese. Thank y

    Hi, I have to Malaysia, I'm trying to load down the lightroom and cc photo shop trial for the test. but after installation I know is English version! for me, I want to use the version Chinese, how can I change the version English version Chinese. Thank you

    Hi Alexl2684899,

    Please visit the below mentioned link:

    Change the language of Adobe Creative Cloud applications

    Let us know if that helps.

  • How can I send my site map of Muse for the approval of the customer?

    How can I send my site map of Muse for the approval of the customer? Thank you.

    Hello

    There are many options for a file sharing - you could copy it to a company network server, or send the file back, or use a service like Dropbox, SendThisFile, Adobe SendNow file sharing or Creative cloud sync, among others.

    What is right for you depends on the size of your file, how many times you send the file back and personal preferences

  • By comparing the two tables for the integrity of the data

    Hi all
    I need to compare two tables for the integrity of the data through the SQL query.

    If you need to compare all the columns of t1 to t2:

    (SELECT * FROM t1
    MINUS
    SELECT * FROM t2)
    UNION ALL
    (SELECT * FROM t2
    MINUS
    SELECT * FROM t1);
    

    Kind regards
    Ankit Rouault
    http://theoraclelog.blogspot.in

Maybe you are looking for

  • Netflix doesn't restart in mode 32-bit firefox update

    I woke up one morning to find a new version of firefox on my mac. Since then, I have not been able to get Netflix to work because it asks me to restart in 32-bit mode. Before update the rebooted yellow bar Netflix with no problems, now he spends just

  • Need to Backpack for my Satellite P200

    Hello I am looking for a Satellite P200 backpack. But what I found is a 15.4 "backpack (PX1417E-1NCA).Can someone help me please? Thank you

  • NEITHER 9219 fully supported on the RIO MXI-Express?

    I'm trying to choose for my RIO MXI-Express chassis cRIO modules and I fell on the NI 9219 universal module.  While reading the user guide, I noticed that it is said in two separate sections as the 'Digital mode' and "Mode of Contact open' is 'suppor

  • Pavilion 23bw

    So u just bought a Pavilion 23BW and I realized they were no pregnant, this isn't really a problem for me at the moment but id like having her for the future. The sound on the computer system said can I liked on a speaker or headphones, I have headph

  • Can I move my files on my D drive and then use them to reinstall once I have upgraded to Windows7

    I am running Vista and want to upgrade to Windows 7.  I have two hard drives on my computer, C, and D.  Can I use D to store my files while I install Windows7 and then move them back on the C drive?