Replacements of the passes of the constraint are not made.

Hello

I adjusted the following piece of code pl/sql - in order to show what's wrong. The complete pack is great - it has some errors, I try to debug and modify.

It's so (as anonymous block) :

declare

TYPE columns_rec IS RECORD (c_name VARCHAR2 (32),)

c_type VARCHAR2 (32),

c_length number (4,0).

c_scale number (4,0).

c_null varchar (20));

TYPE cols_t IS TABLE OF THE columns_rec;

p_Pkcols cols_t;

p_nonPkcols cols_t;

l_allCols cols_t: = cols_t();

l_str varchar2 (4000);

p_prefix varchar2 (50): = 'FA_SITES_NEW.';

CURSOR c_pk is

SELECT c.column_name, data_type,

Decode (data_precision,

NULL, data_length,

TO_NUMBER(data_precision-data_scale)) data_length,.

data_scale,

Nullable

Of user_tab_columns c,.

user_constraints uc,

user_cons_columns cc

WHERE uc.owner = USER

AND uc.constraint_name = cc.constraint_name

AND c.table_name = cc.table_name

AND c.column_name = cc.column_name

AND uc.table_name = cc.table_name

AND uc.table_name = 'FA_SITES_NEW. '

AND constraint_type = 'P '.

ORDER BY cc.position;

---------------

CURSOR c_non_pk is

SELECT column_name, data_type,

Decode (data_precision,

NULL, data_length,

TO_NUMBER(data_precision-data_scale)) data_length,.

data_scale,

Nullable

C USER_TAB_COLUMNS

WHERE table_name = 'FA_SITES_NEW '.

AND NOT EXISTS)

SELECT 1 FROM user_constraints uc, user_cons_columns cc

WHERE uc.owner = cc.owner

AND uc.table_name = c.table_name

AND cc.column_name = c.column_name

AND uc.constraint_name = cc.constraint_name

AND uc.table_name = cc.table_name

AND constraint_type = 'P')

order by nullable;

-------------

CURSOR c_cons is

SELECT cc.column_name, c.constraint_name, c.search_condition,

Decode (c.constraint_type, 'P', 'Pk', 'U', 'Uk', 'R', 'Fk', 'Check') c_type

From user_constraints c,.

user_cons_columns cc

WHERE c.owner = USER

AND c.constraint_name = cc.constraint_name

AND c.table_name = cc.table_name

AND c.owner = cc.owner

AND c.table_name = 'FA_SITES_NEW. '

AND constraint_type in ('P', 'R', 'C', 'U')

ORDER BY decode (c.constraint_type, 'P', 1, 'U', 2, 3);

Start

Open c_pk;

collect the fetch c_pk in bulk in p_Pkcols;

close c_pk;

Open c_non_pk;

collect the fetch c_non_pk in bulk in p_nonPkcols;

close c_non_pk;

l_allCols: = p_PkCols p_nonPkcols union multiset;

FOR cfl_cons in c_cons

LOOP

IF upper (cfl_cons.c_type) = 'VERIFICATION' THEN

l_str: = cfl_cons.search_condition;

because me l_allCols.first... loop of l_allCols.Last

l_str: = replace (l_str, l_allCols (i) .c_name, p_prefix | l_allCols (i) .c_name);

dbms_output.put_line (l_str);

end loop;

END IF;

END LOOP;

end;

The script that creates the table is:

CREATE TABLE FA_SITES_NEW

(

AA              NUMBER(5)                     ,

CODE_CC VARCHAR2 (12-BYTE),

DESCR_CC VARCHAR2 (60 BYTE),

CODE_EGK VARCHAR2 (5 BYTE),

VARCHAR2 (80 BYTE) EGK,

CODE_THESIS VARCHAR2 (5 BYTE),

ADDRESS VARCHAR2 (100 BYTE),

TK VARCHAR2 (8 BYTE),

DATE OF VALIDDATE_FROM,

DATE OF VALIDDATE_TO,

VARCHAR2 (200 BYTE) NOTES,

LASTINSU VARCHAR2 (20 BYTE),

DATE OF LASTINSD,

LASTUPDU VARCHAR2 (20 BYTE),

DATE OF LASTUPDD,

CODE_CC_VC VARCHAR2 (15 BYTE) GENERATED ALWAYS AS ("000" |) ("' CODE_CC")

)

;

ALTER TABLE FA_SITES_NEW ADD)

CONSTRAINT FA_SITES_NEW_CHK

CHECK (validdate_from < = validdate_to));

Now the problem is - except that the constraint appears several times(let's leave it for now) - replacement is not done.

In other words, the constraint is "validdate_from < = validdate_to ' and I want to be replaced as FA_SITES_NEW.validdate_from < = FA_SITES_NEW.validdate_to (that's why I use l_str: = replace (l_str, l_allCols (i) .c_name, p_prefix | l_allCols (i) .c_name);).

Instead, the chain remains validdate_from < = validdate_to.

I also tried to do the replacement in a sql stmt ' select replace (l_str, l_allCols (i) .c_name, p_prefix |)» "l_allCols (i) .c_name) in double l_str", but to no avail.

Is it possible this minor change to the result?

NOTE: I use oraDb 11.2.

Thank you very much

SIM

I don't understand. Why do you want to include the name of table to the columns that are used inside the check constraint? This will make the invalid constraint if you rename the table. It seems much better to have the name of the column without a name to additional table.

The problem could be that the expression within the constraint uses lowercase column names, while your system column names select uppercase letters in the data dictionary. This is why replacing is not picking up the names.

Tags: Database

Similar Questions

  • I upgraded my Vista Home premium to windows 7 ultimate, shortcuts on the desktop are not displayed, and can be created, or any folder cannot be created until the flash drive is reinserted

    during the upgradation he automatically took backup to an external flash drive, now every time I have to run has previously program I have to insert this flash drive.
    also all the shortcuts on the desktop are not displayed, and can be created, or any folder cannot be created so that the flash disk is reinserted

    Hi subhshy001,

    Welcome to the Microsoft Windows answers Forum community!

    Try this if you do not have

    Windows Explorer to create the folders and shortcuts in your document folder, drag and drop them on your desktop.

    If you have completed the steps and was not even useful,

    Follow these steps:

    Try to create a shortcut and sending it on the desktop.

    (1) open: Start Menu ,.
    (2) right-click: Internet Explorer icon .
    (3) select: send to > desktop (create shortcut).

    There should be a shortcut on the desktop .

    Make sure that the "show desktop icon" has a check against it

    OR

    Just click on the empty part of the desktop, choose new > then select the folder to create. Right click on this folder , select Rename it.

    If the steps above do not work then:

    You can scan your computer for malware.

    You can download, install and update anti-malware free of your favorite search engine and find malware.

    Important note:
    this response contains a reference to third party World Wide Web site. Microsoft provides this information as a convenience to you. Microsoft does not control these sites and no has not tested any software or information found on these sites; Therefore, Microsoft cannot make any approach to quality, security or the ability of a software or information that are there. There are the dangers inherent in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    If the scan comes back clean, so I recommend doing a System File Checker too l to analyze your OS system files.

    To help resolve this problem, use the tool (SFC.exe) System File Checker to determine which file is causing the problem and then replace the file. To do this, follow these steps:

    1. open an elevated command prompt . To do this, click Start , click principally made programs , Accessories , right-click guest , and then click run as administrator .  If you are prompted for an administrator password or a confirmation, type the password, or click allow .
    2. type the following command and press ENTER: sfc/scannow (Yes there is a space after sfc) the sfc/scannow command analyzes all protected system files and replaces incorrect versions with appropriate Microsoft versions. This analysis do take some time to complete.

    Hope this information helped!

    Thank you, and in what concerns:

    Aziz Nadeem - Microsoft technical support.
    Visit our http://social.answers.microsoft.com/Forums/en-US/answersfeedback/threads/ Microsoft answers feedback Forum and let us know what you think.

  • Pavilion a1620n won't start, the fans are not running. PS on the light and Sun. Start button does not illuminate

    Pavilion a1620n won't start, the fans are not running. PS on the light and Sun. Start button does not illuminate. EU tested ps and I was told it was OK. Disconnected from the motherboard except course before directed ps button and the cpu fan has become much brighter, but that's all that happened. Any suggestions on what to check? Checked with VOM push and he seemed to agree. Replaced the MB with the new Board of Directors, that didn't work either. Don't know if it was any good, it was a store Bulletin Board.

    All the indicators you mention leads to the PSU, not the Board of Directors.

  • Photos marked as favourites on the iPhone are not appearing in the Favorites folder in the pictures on Mac

    I mark my favorite photos directly on the iPhone. When downloaded from Photos on iMac selected Photos "Favorites" on the iPhone are NOT appearing in the Favorites folder.

    Apple forces us to use iCloud to operate? Because that I do not use iCloud and I used!

    IF you do not use iCloud photo library, favorite sides will not be synchronized.

  • The documents are not displayed

    My items in the Documents are not displayed.

    I recently downloaded OS X El Capitan.   The problem might be related to that?

    Thank you very much.

    Have you tried a Spotlight search for the name of one of these files?

  • For the second time in two months, all my messages in the Inbox are not there. Only the SUBJECT and the FROM is left. Tried to 'fix this folder' and lost ALL

    For the second time in two months, all my messages in the Inbox are not there. Only the SUBJECT and the FROM is left.

    Tried to 'fix this folder' and ALL - lost ALL the Inbox.

    The file is still there and works well...

    How can I stop it and what are the causes?

    Thank you all, Gabe

    If you have the file somewhere on your hard drive, export and import tools it will be important back to Thunderbird.

    https://addons.Mozilla.org/en-us/Thunderbird/addon/ImportExportTools/

    Instructions http://chrisramsden.vfast.co.uk/3_How_to_install_Add-ons_in_Thunderbird.html

  • Icons, twitter bolts on the site are not displayed?

    According to the bounding, icons pictures, twitter bolts on the site are not displayed?
    Help please?

    Many sites now use downloadable fonts to create their icons instead of the traditional image files. So, there are some Firefox settings that might be a factor, as well as the NoScript extension, if you use this (blocked objects).

    (1) in the dialog box fonts Advanced, unchecking the checkbox which allows the site to use its own choice of fonts. To check that:

    "3-bar" menu button (or tools) > Options > content > button "Advanced".

    Here you must "allow pages to choose their own fonts.

    (2) on the deactivation of fonts downloaded in: config. It's less likely, or you remember probably not, but here's how to check on it.

    • In a new tab, type or paste Subject: config in the address bar and press ENTER. Click on the button promising to be careful.
    • In the search box at the top of the list, type or paste the gfx and make a pause so that the list is filtered
    • If gfx.downloadable_fonts.enabled preference is bold and user, set false, double-click it to return it true.

    This seems useful.

  • The photos are not displayed correctly in Firefox, but displayed correctly in Safari and Chrome G.

    Display of Firefox about that clients site problems:
    http://gardenia.dk/collections/collection/

    The photos are not displayed correctly in Firefox - only a very little bit of the image is visible, bad scale (displayed correctly in Safari and Google Chrome).

    Can I do anything to make it work in Firefox, too?

    Kind regards
    Annette

    You do not see the thumbnail, but the big picture because the width of the thumbnail image is set to 500.

    Add code to the userContent.css file.

    The file userChrome.css (UI) customization and userContent.css (Web sites) are located in the chrome folder in the Firefox profile folder.

    @-moz-document domain(gardenia.dk){
     a.thickbox > img { width: 120px !important; }
    }
  • I added Wikipedia and Wikivoyage to my search engine and the icons are not there. How can I add them?

    In the search in the top right of my browser, I recently added Wikipedia and Wikivoyage as options, but the icons are not there. Instead, I have a blank white page instead of the icons. How can I fill them in?

    This also happens on my laptop which is a Macbook Air, so it's not limited to the Windows 7 version of Firefox.

    When there is no data icon in the XML file, then Firefox will be able to display such an icon.

    Try adding on Mycroft Project website search engines.

  • I get emails with pictures and when I send them to others. they open them but the images are not displayed. The photos are there when I send them. Thank you

    I get emails with pictures and when I send them to others. they open
    their place but the images are not displayed. The photos are there when I send a
    them. Thank you

    Make sure that your security software (antivirus) is not blocking attachments.

  • I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not download apps

    I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not downloading the applications Can u find out what's wrong? I use iPhone 5s

    I had the same problem. At the same time hold the screen lock button and the home button until your iPhone restarts. That solved the problem for me.

  • Most of the sites are not loading on all browsers

    Hello

    2 weeks ago my MacBook Pro was working fine and I used it on the internet using an Ethernet cable for the 1st time. Then I had to travel and come back 2 days without it. When I tried to use it via my WiFi router, I realized that most of the sites are not loading on safari, chrome, firefox, etc. Only Youtube, Facebook, Twitter, Apple.com, Google and Yahoo are working. When I try other websites I get messages such as;

    Unable to connect

    Firefox can't establish a connection to the server www.google.com.

    The site may be temporarily unavailable or too busy. Try again in a few moments.

    If you are unable to load any pages, check your computer's network connection.

    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.


    and


    Safari cannot connect to the server.

    Other applications using internet work very well. My router is also OK. When I use the laptop mode safe mode everything works fine and I can access the sites but I need my machine in its maximum capacity.

    Please help me, I would greatly appreciate it

    Thank you

    This is probably a problem with Server DNS (Domain Name). If you enter anything in the DNS domains for your Wi - Fi configuration, it rolls too the parameters provided by your router.

    The best way to dig you out of ANY configuration problem, is to set up again from scratch, using:

    System Preferences > network > Wi - Fi > (help me) > (Assistant)...

    Be sure to specify a set of 'Place' new, mnemonic name, NOT the default. After answering questions, don't forget to click (apply) and close the window to have the changes take effect. Now, this set of parameters can be applied "all at once" when you're back at this place.

    When, in another location, create a new package from 'Rental' from scratch, so as not to crush those who work somewhere else.

  • Buttons on the Panel are not more enlightened

    Buttons on the Panel are not more enlightened. How can I solve this?

    Enter the parameters of the BIOS (F2 at startup) and under Advanced BIOS options you will find LED illumination. Set it on, save the BIOS settings and restart your laptop.

    Does that help?

  • ArraytoChannels error 'cannot be added because the channels of the target are not all the same length.

    Hello!

    After the end of my second day of test error, I put this question on the table:

    I use ArraytoChannels function to store ADO recordsets as strings. What is strange, is that for the first Recordset, it works; but for the next time through the loop, it always fails with the error message 'cannot be added because the channels of the target are not all the same length.

    I confirmed that:

    the RowData sizes and the ChannelNames are equal,

    both spend the isarray = true test,

    I change the order of the ChannelNames,.

    I have reconnected/disconnected from the oConnexion every time, nothing has changed.

    Apparently I'm missing something - but crazy to know what! -If anyone can share his opinion I'll so much appriciate. Here is my code:

    oTables = Array ("WellStates", "ChokeData", "WellParameters", "FlowData", "PumpData", "SensorsData", "ModelCalculatedData")

    Call OpenSQLConnection
    Set oRecordset = CreateObject ("ADODB. Recordset')
    Call SelectWell
    Call GetWellStateIDs

    Data.Root.Clear
    for j = 0 to ubound(oTables,1)

    sSQLSting = "select * []" & oTables (j) & "] where [WellStateID] between" & WellStateIDFirst & "and" & WellStateIDLast ".
    oRecordset.Open sSQLSting, oConnexion
    Protected oFieldNames: table: ReDim oFieldNames (orecordset. Fields.Count - 1).
    for i = 0 to orecordset. Fields.Count - 1
    oFieldNames (i) = orecordset. Fields.Item (i) .name
    next
    oArray = oRecordset.GetRows (-1, 0, oFieldNames)
    Set oGroup = Data .root .ChannelGroups .Add (oTables (j))

    oArray, oFieldNames arraytochannels
    oRecordset.close
    oConnection.Close
    next

    Sub GetWellStateIDs
    sSQLSting = "select * from [WellStates] where [wellid] =" & WellID
    oRecordset.Open sSQLSting, oConnexion
    oArray = oRecordset.GetRows)
    WellStateIDFirst = oArray (0,0)
    WellStateIDLast = oArray (0, ubound(oArray,2))
    oRecordset.close
    EndSub

    Sub OpenSQLConnection
    Set WshNetwork = CreateObject
    oComputerName = WshNetwork.ComputerName
    oDB = "MX2. Player.DB ".
    Set oConnexion = CreateObject ("ADODB. Connection")
    oProvider = "Provider = SQLOLEDB.1; Integrated Security = SSPI; PeoExecuteist Security Info = True; Data Source ='
    oProvider = oProvider & oComputerName & "\MX; Use procedure for prepare = 1; Machine translation = True; The packet size = 4096; Workstation ID ="
    oProvider = oProvider & oComputerName & " Use encryption for data = False; Tag with column collation when possible = False; Initial Catalog ='
    oProvider = oProvider & oDB
    oConnection.ConnectionString = oProvider
    oConnection.Open
    EndSub

    Another clue. If you check using DIAdem

    Microsoft Windows Script Debugger

    you are able to install the debugger in DIAdem.

    It would potentially have shown that the command does not work as expected.

    Sorry for the inconveniance

    Andreas

  • When I send emails containing photos, which were reported by the recipients that the photos are not coming.

    When I transfer emails containing images, it has been reprted bythe recipients that the pictures are not coming. Explain please.

    original title: transfer of emails

    What email program are you using?

Maybe you are looking for