Rename the name of foreign key programmatically
Hello
I tried to rename a foreign key by program through this code of Rhino:
var tables = model.getTableSet().toArray(); for (var tidx = 0; tidx<tables.length;tidx++){ var table = tables[tidx]; var keys = table.getKeys(); var keyCount = keys.length; for (var kidx = 0; kidx<keyCount;kidx++){ var key = keys[kidx]; if (key.isFK()) { var keyName = key.getName(); if (keyName.endsWith("___FK")) { var keyNameLength = keyName.length(); var newKeyName = keyName.substring(0,keyNameLength - 5) + "_FK"; key.setName(newKeyName); table.setDirty(true); } } } }
I was expecting to change the name of any foreign key when the name ends in '___FK' and simplify it to "_FK".
It changes something, as you can see on this picture, but not all:
The green ellipse indicates the place where the replacement has been successful, the reds, the places where the old names of foreign key has not changed.
I would like to know what to do in my script.
Thank you in advance,
Gábor Tóth
Hello
Try this one:
var tables = model.getTableSet () .toArray ();
for (var tidx = 0; tidx<>
var table = tables [tidx];
var keys = table.getFKAssociations ();
var keyCount = keys.length;
for (var kidx = 0; kidx<>
var = key keys [kidx];
keyName var = key.getName ();
If (keyName.endsWith ("___FK")) {}
var keyNameLength = keyName.length ();
var newKeyName = keyName.substring (0, keyNameLength - 5) + "_FK";
key.setName (newKeyName);
table.setDirty (true);
}
}
}
Tags: Database
Similar Questions
-
Unwrapping names of foreign key in relational model
Hello
In the process of the engineer to the relational model, foreign keys get automatically wrapped. Is there somewhere a (preferably) parameter to avoid this problem? Or a function in a single step? Currently, I have to select each name and make it wider, which is very tedious. And they run again after another engineer to the relational model.
If there is no option, I would ask for an improvement allow this. Thank you very much.
Robert
Sorry, a step is missing - 2.1 close design (after registration)
Basically when I say save design, close it and open it, that can be applied to the model itself - save, close, load - from browser
Philippe
-
Cannot use fax function after rename the name of the printer
I have an MFP HP LaserJet M1536DNF connected by network. I have run the full setup package by the CD of the product, or on the web, complete update install the driver package. The problem is the default printer name after installation as like "HP LaserJet 1530 MPF Series PCL 6" and can not be changed through the installation. When I tried to change the printer name on the windows 'Printers and faxes', he managed but the fax doesn't work anymore after that. It says probably 'impossible to find or connect the printer' after I click the fax or print the document to the fax printer. However, I can still use the printing function after the name change. The only way to solve now is to uninstall all and reinstall again, even I tried to rename back the name exactly for the name of the printer. I use Window XP Pro SP3 with .net Framework 3.5 already up-to-date. Thanks for the tips.
Hi Cheetah12,
Sorry to misunderstand. I mean there is no option to not rename the printer when you run the complete package installation wizardfirst, but not the fax configuration wizard.
In fact, I must mention once again that I have can print and scan even I renamed the printer. Things I can't do the HP Send Fax or fax HP Setup Assistant and so, which means my fax machine was not working properly.
Therefore, I follow the document from HP that you post step by step and of course the diagnosis by downloaded HP Print result and doctor Scan for both printing and scanning are in good health, all in green light! But cannot always solve the problem of the fax.
However, I finally found my way to solve the problem, which is just rename back the original printer name in the registry. As a result, the printer in "Printers and faxes" which always shows the famous name, but actually running with the original name of the printer.
In any case, thank you for your kindly help and fast track. But I suggest there should be a direct way, like having an option to rename the name of the printer while the first installation wizard on your next updated version. This will certainly help users who have to install 2 or more of the same model printer, to indicate which printer works easily.
-
Suddenly, every time I press on a modifier (shift, ctrl, or alt) key an icon indicating the name of this key appears on the screen. I do not change settings or do something out of the ordinary. I checked the Tablet and my keyboard settings (I use a wacom tablet and mouse instead of a regular desktop mouse) and everything is normal. I also assured that StickyKeys is turned off. It's incredibly annoying, please help.
Thank you
MHello
I suggest you to see link below and check if it helps.
Reference: http://forum.wacom.eu/viewtopic.php?f=4&t=2144&start=0
Hope this information is useful.
-
Rename the name of Module e/s in M1000e
Hi friends, is it possible to rename the name of Module e/s in M1000e? For example, in SLOT A1 in the name field displays the switch model and I would like to configure to display the name of switch´s.
Concerning
Hello
There is not a way to rename the switches, only the server slots.
-
Hello
Can I remove Logical columns at the level of the business layer that I'm not going to use the layer of presentation as the ID or foreign key columns? It will not affect the relations to the business layer?
Kind regards
Nestor
Hi Nestor,.
It won't unless they are used as keys, columns sort order, the ID column or the likes. But you can leave them in the MDB layer and expose just in the presentation layer - just in case you need it later. It is not use all the resources or generate overhead. More: Developer of the RPD should be used to work with loads of columns
-
Rename the name of the file without updating the metadata
Hello
I'm new to LR and would like to know if it is possible to rename the name of the file in LR 5 (after the import of images) without changing the name of the original file in the EXIF metadata? For example, the name of the original file is DSC_1234.NEF and I would like to rename it to "Hawaii_1234.NEF" in the catalog, as well as the name of the file on the HARD disk, but woud like to keep the original "DSC_1234.NEF" in the metadata.
It seems that LR also renames file name in metadata if I read earlier rename after import (through the library - option Rename pictures) will not change the name of 'original' file in the metadata.
Thank you.
André.
Hmm - confusing...
I mean, Lr going to keep "DSC_1234.NEF" as the piece of metadata named "Original file name", after you rename the file "Hawaii_1234.NEF". The 'current' file name, in the metadata, will of course be the new file name (Hawaii_1234.NEF).
Did you want something different?
Rob
-
Rename the name of the BPEL process
Hello
We are working on JDeveloper 11.1.1.5.0 and created a BPEL process in composite and wired it.
Can someone tell me how to rename the name of the BPEL process which is given earlier.
SidonieIt is a long process, but you can try this...
https://blogs.Oracle.com/middleware/entry/renaming_bpel_process_names -
Rename the name of the connection Wireless in Windows 8
In Windows 7, it was possible to change the name of the wireless connection to something meaningful (what a concept). For example my home wireless with ssid xxxxxxxx be named home wireless. When I connected to the Office Wireless (with a ssid of yyyyyyyy) he would be named Office Wireless.
This seems to be is no longer possible in Windows 8. Microsoft is way too much fun playing silly blighters. They have really taken to a whole new level with this OS.
After much research I found how to rename a wired connection, but not wireless. For the life of me I can't figure out how to do this.
I'm * NOT * request your opinion on whether I should do this. I ask * HOW * to do this. (Futile attempt to ward off the unnecessary and inevitable "you shouldn't do" or answers "I don't see why you would want to...) »)
Maybe what you are looking for requires you to access the registry to make the name change.
HKLM\Software\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles
Browse the list of profiles to find the one that you need, and then change the value of string ProfileName.
You can also do this when you change wireless cards and to reconnect to the same network and the connection then presents itself as 'name 2 Wireless' or ' wireless 3 "instead of just"wireless name' name, you can delete old profiles of the same name, and then rename the current without the number on the end. "
After changes simply refresh your list of network connections to view the changes.
As always, changes in the register are not advised, so with caution, take a backup before you change etc etc.
-
DB does not open after you rename the name of the database
Hi all
I tried to change the name of the db, so I created new controlfile trace and set it as. I created controlfile successfully, my open db with success, but when I stopped and tried again to open it I saw the below error message
CREATE CONTROLFILE SET DATABASE 'db2' RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\REDO01. NEWSPAPER "SIZE M 50,
GROUP 2 ' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\REDO02. NEWSPAPER "SIZE M 50,
GROUP 3 ' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\REDO03. NEWSPAPER "SIZE M 50
-STANDBY LOGFILE
DATA FILE
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\SYSTEM01. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\UNDOTBS01. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\SYSAUX01. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\USERS01. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB2. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB21. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB211. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB212. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB213. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB214. DBF',.
' C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB215. DBF'
WE8MSWIN1252 CHARACTER SET.
ALTER DATABASE OPEN RESETLOGS;
SQL > @e:\creatdbdb2.sql;
Created control file.
Database altered.
SQL > select file_name in dba_data_files;
FILE_NAME
---------------------------------------------------------------------------
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB215. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB214. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB213. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB212. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB211. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB21. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\DB2. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\USERS01. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\SYSAUX01. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\UNDOTBS01. DBF
C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\SYSTEM01. DBF
11 selected lines.
SQL > shutdown immediate;
The database is closed.
The database is dismounted.
ORACLE instance stops.
SQL > startup;
ORACLE instance started.
Total System Global Area 612368384 bytes
Bytes of size 1250428 fixed
222301060 variable size bytes
381681664 of database buffers bytes
Redo buffers 7135232 bytes
Mounted database.
ORA-00313: open failed for the members of the Group of newspapers wire 2 1
ORA-00312: wire 2 1 online journal:
'C:\ORACLE\PRODUCT\10.2.0\DB_3\DATABASE\LOG2db2.ORA '.
ORA-27041: could not open the file
04002 - OSD: could not open the file
S/O-error: (OS 2) the system cannot find the file specified.845470 wrote:
control_files string C:\ORACLE\PRODUCT\10.2.0\DB_3\
DATABASE\CTL1NIRAJ. ORAI guess, you create controlfile as the directory of log files "C:\ORACLE\PRODUCT\10.2.0\ORADATA\db2\".
So now, you will need to change pfile to again match controlfile.sql>create pfile='c:\pfile.ora' from spfile;
Change the section of the command file "c:\pfile.ora" to match your NEW control file.
then start DB, using the new file pfilesql> startup mount pfile='c:\pfile.ora';
Check the locations of the data file and log files from views v$ datafile and v$ logfile.
If everything is ok - open the database and create spfile
sql>create spfile from pfile='c:\pfile.ora';
Published by: Nikolay Ivankin on 23.03.2012 11:23
-
can we rename the name of the backend responsibility? How?
Hello
can we change the name of the backend responsibility? Via FNDLOAD or somehow?
Thanks in advance,
Sandeep.Hello
Try to use the APPS. FND_RESPONSIBILITY_PKG API - Search eTRM and MOS sites for more details on this package.
FNDLOAD could also be used if you are migrating from one instance to another responsibility by editing the TDL file.
Thank you
Hussein -
Script to rename the names of information link
I'm working on the conversion of a catalogue of old customers from Quark to Indesign. I use Indesign CS4 on Windows Vista. I used Markzware Q2ID to convert indesign catalog with too many problems. But I ran into a big problems with the images. They will be automatically re-issued. After digging around, I found the problem. For some reason any all Image names also include the path structure.
For example
Link Info
Name: BDA - 12:Users:graeme:Desktop:FSIP back-up: _Collected:02405 PESA AftMkt EAST: photos: M587524. EPS
Path: BDA - 12:Users:graeme:Desktop:FSIP back-up: _Collected:02405 PESA AftMkt EAST: photos: M587524. EPS
Luckly that all names have the same problem. So I hope find or write a script that can simply go through the indesign document and find/replace all the names link to remove "BDA - 12:Users:graeme:Desktop:FSIP back-up: _Collected:02405 PESA AftMkt EAST: photos:
I know it is a very simple problem, but it's my first real attempt to script something in Adobe. Anyone have any good ideas or tips on how I could do this?
Thank you
VIC Bushfield
Victor,
The conversion program totally corrupt links in your document: myLink.filePath is just empty string, myLink.name, this is what should have been myLink.filePath (this is info from ESTK).
Here is a new version of the script - it rebuilt to the files located in the folder NewLinks on the desktop. Change this line
var myNewPath = '~/Desktop/NewLinks/' + MyName;
to the location of your links.
WARNING - I tested it on Mac, because do not have a copy of CS4 for Windows.
Kasyan
//----------------------------------------
indesign #target
If (app.documents.length == 0) {}
Err ("no document open. Please open a document and try again. ", true);
}myDoc var = app.activeDocument;
myLinks var = myDoc.links;
var myCounter = 0;If (myLinks.length == 0) {}
Err ("this document contains no links.", true);
}for (i = myLinks.length - 1; I > = 0; i--) {}
myLink var = myLinks [i];
var myArr = myLink.name.split(":")
var myArr = myName [myArr.length - 1];
var myNewPath = '~/Desktop/NewLinks/' + MyName;
var myNewFile = new queue (myNewPath);
If {(myNewFile.exists)
myLink.relink (myNewFile);
myCounter ++;
}
}
If (myCounter == 1) {}
Alert ("a file has been relinked.", "Completed");
}
ElseIf (myCounter > 1) {}
alert (myCounter + "files were relinked.", "completed");
}
else {}
Alert ("Nothing has been relinked.", "completed");
}function err (e, icon) {}
Alert (e, "Update path names Script", icon);
Exit();
} -
Rename the name of a file in Sansa Clip +.
Why can't I rename a file or folder name in the Sansa clip +. ???
It is a big problem in Sansa.
I should rename my file name before you plug it into the computer to transfer.
There are some who have problems of "naming" when you use MTP mode. In fact, sometimes this mode will be re - their name to something totally different from what they were originally. I would try formatting your player, which will erase all content, switch to MSC mode (settings > system settings > USB Mode) and re - transfer your files back. You should be able to name them as you wish.
-
Rename the name of the table dynamically in a loop
Hi all
It might not be the best solution, but it is a starting point for me. I have tables: x1_old, x2_old... x1_new, x2_new...
When I receive new tables, it's x 1, x 2... You need 3 things:
1 x1_old, x2_old must be removed
2 x1_new, x2_new must be renamed to x1_old, x2_old
3 x 1, x 2 tables can be renamed to x1_new, x2_new.
I hope this makes sense.
I managed to drop the tables dynamically(step 1). But impossible to apply a similar approach to rename (step 2 and 3).
Following the code gives an error: ORA-00900: invalid SQL statement
DECLARE
x NVARCHAR2 (50): = ";
y NVARCHAR2 (50): = ";
BEGIN
-Rename tables ending in 'NEW' for 'OLD '.
FOR x IN (SELECT table_name
From all_tables
Owner WHERE to = "OWNER_X."
AND SUBSTR (table_name,-3) = 'NEW')
LOOP
y: = SUBSTR (x.table_name, 1, INSTR (x.table_name, 'NEW') - 1) | 'OLD ';
EXECUTE IMMEDIATE 'Rename ' | x.table_name | « à » || y;
END LOOP;
END;
/
I read that I can't use DOF with Execute imeediate. No work around? Or different approach?
Thank youI had where you went wrong.
SQL> ed Wrote file afiedt.buf 1 DECLARE 2 x NVARCHAR2(50) := ''; 3 y NVARCHAR2(50) := ''; 4 BEGIN 5 --Rename tables that end with 'NEW' to 'OLD' 6 FOR x IN (SELECT table_name 7 FROM all_tables 8 WHERE owner = 'HR' 9 AND SUBSTR(table_name, -3) = 'OLD') 10 LOOP 11 y := SUBSTR(x.table_name, 1, INSTR(x.table_name, 'OLD') - 1) || 'NEW'; 12 dbms_output.put_line('ALTER TABLE ' || x.table_name || ' rename to ' || y); 13 EXECUTE IMMEDIATE 'ALTER TABLE ' || x.table_name || ' rename to ' || y; 14 END LOOP; 15* END; SQL> / ALTER TABLE X1_OLD rename to X1_NEW DECLARE * ERROR at line 1: ORA-00900: invalid SQL statement ORA-06512: at line 13
Now updated the code
SQL> ed Wrote file afiedt.buf 1 DECLARE 2 x VARCHAR2(50) := ''; 3 y VARCHAR2(50) := ''; 4 BEGIN 5 --Rename tables that end with 'NEW' to 'OLD' 6 FOR x IN (SELECT table_name 7 FROM all_tables 8 WHERE owner = 'HR' 9 AND SUBSTR(table_name, -3) = 'OLD') 10 LOOP 11 y := SUBSTR(x.table_name, 1, INSTR(x.table_name, 'OLD') - 1) || 'NEW'; 12 dbms_output.put_line('ALTER TABLE ' || x.table_name || ' rename to ' || y); 13 EXECUTE IMMEDIATE 'ALTER TABLE ' || x.table_name || ' rename to ' || y; 14 END LOOP; 15* END; SQL> / ALTER TABLE X1_OLD rename to X1_NEW ALTER TABLE B_OLD rename to B_NEW ALTER TABLE A_OLD rename to A_NEW PL/SQL procedure successfully completed.
-
name of the foreign key column
I'm new to the SQL Developer Data Modeler, I try to use it so that I can recommend to peers.
in the logic model, I created 2 entities:
entity: order_headers
attributes: header_id (primary key), order_number
entity: order_lines
attributes: line_id (primary key), item_code
and then I create a relationship 1: n to order_headers to order_lines
Now if I find out the attributes of order_lines, there are 3 attributes:
line_id, item_code and header_id
I do an "engineer of the relational model
in the Relational_1, I see that my order_lines table has a field: order_headers_header_id
How can I configure step 'Engineer to the relational model' to use 'header_id' instead of 'order_headers_header_id '?
I use Oracle SQL Developer Data model version 4.0.1.836 build 836
Hello
You must change the name for "Foreign key column" model in the design properties dialog box - "settings > Naming Standard > models.
It should be {column Ref} only to get required name.
Philippe
Maybe you are looking for
-
Impossible to update the iPad 2 Air for iOS 9.3
My Air 2 Apple shows a notice of an update software iOS 9.3. When I click on 'Install now', the message 'Update Veryfing' shows, but misses "cannot verify the update. iOS 9.3 failure of verification because you are no longer connected to the Interne
-
Dysfunction of the brightness of the screen - Satellite M100
Hello I have a strange problem with my Toshiba m-100.The brightness of the screen seems to not work in reverse. So when windows starts even if the computer is configured for the brightness of the full screen, it shows also very dark. When to use the
-
SSD + El Cap Upgrade on Intel Core2 Duo MBP?
Hello My partner has a really slow 13 "Mid 2010 build MBP Yosemite running. Its processor is an Intel Core 2 Duo 2.4 GHz 4 GB of RAM running I'm about to take the plunge and order, the HD of SSD Crucial BX100 with a capacity of 250 GB and install it
-
How to fix this error "0xc0150004.
Programs, I have problems with: microsoft office 2007, adobe have 2008, ACDsee 10, google earth (the most important thing) Error messages "0xc0150004. The recent changes I made to my computer: nothing much. What I tried to solve the problem: "uninsta
-
ASA 8.0.3 vulnerable to attacks BACK TCP?
Can anyone confirm if the ASA 8.0.3 image is affected by the denial of service (DoS) vulnerabilities that manipulate the State of the Transmission Control Protocol (TCP) connections?