constraints

Oracle find a constraint

浪尽此生 提交于 2019-12-17 21:38:14
问题 I have a constraint called users.SYS_C00381400 . How do I find what that constraint is? Is there a way to query all constraints? 回答1: select * from all_constraints where owner = '<NAME>' and constraint_name = 'SYS_C00381400' / Like all data dictionary views, this a USER_CONSTRAINTS view if you just want to check your current schema and a DBA_CONSTRAINTS view for administration users. The construction of the constraint name indicates a system generated constraint name. For instance, if we

constrOptim in R - init val is not in the interior of the feasible region error

老子叫甜甜 提交于 2019-12-17 21:33:15
问题 I am trying to use constrOptim package. Here is my set up: test_func <- function(x){ return((x%*%x)[1,1]) } constrOptim(rep(1/3,3), f=test_func,grad = NULL, ui = rbind(diag(3),rep(1, 3), rep(-1,3)), ci = c(rep(0,3),1,-1), method = "Nelder-Mead") it generates error: Error in constrOptim(rep(1/3, 3), f = test_func, grad = NULL, ui = rbind(diag(3), : initial value is not in the interior of the feasible region it is easy to check that my initial value is in the interior of the feasible region

How To Create A 'Two-Sided' Unique Index On Two Fields?

一个人想着一个人 提交于 2019-12-17 21:05:26
问题 How can I efficiently create a unique index on two fields in a table like this: create table t (a integer, b integer); where any unique combination of two different numbers cannot appear more than once on the same row in the table. In order words if a row exists such that a=1 and b=2, another row cannot exist where a=2 and b=1 or a=1 and b=2. In other words two numbers cannot appear together more than once in any order. I have no idea what such a constraint is called, hence the 'two-sided

MySQL: Add constraint if not exists

半城伤御伤魂 提交于 2019-12-17 19:32:43
问题 In my create script for my database create script looking something like this: CREATE TABLE IF NOT EXISTS `rabbits` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL, `main_page_id` INT UNSIGNED COMMENT 'What page is the main one', PRIMARY KEY (`id`), KEY `main_page_id` (`main_page_id`) ) ENGINE=InnoDB; CREATE TABLE IF NOT EXISTS `rabbit_pages` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT, `rabbit_id` INT UNSIGNED NOT NULL, `title` VARCHAR(255) NOT NULL, `content` TEXT

How can I drop a “not null” constraint in Oracle when I don't know the name of the constraint?

拜拜、爱过 提交于 2019-12-17 17:33:56
问题 I have a database which has a NOT NULL constraint on a field, and I want to remove this constraint. The complicating factor is that this constraint has a system-defined name, and that constraint's name differs between the production server, integration server, and the various developer databases. Our current process is to check in change scripts, and an automated task executes the appropriate queries through sqlplus against the target database, so I'd prefer a solution that could just be sent

MySQL ignores the NOT NULL constraint

拥有回忆 提交于 2019-12-17 16:44:23
问题 I have created a table with NOT NULL constraints on some columns in MySQL. Then in PHP I wrote a script to insert data, with an insert query. When I omit one of the NOT NULL columns in this insert statement I would expect an error message from MySQL, and I would expect my script to fail. Instead, MySQL inserts empty strings in the NOT NULL fields. In other omitted fields the data is NULL, which is fine. Could someone tell me what I did wrong here? I'm using this table: CREATE TABLE IF NOT

Removing the CENTER element from a JPanel using BorderLayout

做~自己de王妃 提交于 2019-12-17 16:14:48
问题 Is there any way of removing the Component added to the CENTER of a JPanel with a BorderLayout , without having to reference the Component itself? 回答1: Something like this? BorderLayout layout = (BorderLayout)panel.getLayout(); panel.remove(layout.getLayoutComponent(BorderLayout.CENTER)); 来源: https://stackoverflow.com/questions/759321/removing-the-center-element-from-a-jpanel-using-borderlayout

SQL DROP TABLE foreign key constraint

血红的双手。 提交于 2019-12-17 14:59:48
问题 If I want to delete all the tables in my database like this, will it take care of the foreign key constraint? If not, how do I take care of that first? GO IF OBJECT_ID('dbo.[Course]','U') IS NOT NULL DROP TABLE dbo.[Course] GO IF OBJECT_ID('dbo.[Student]','U') IS NOT NULL DROP TABLE dbo.[Student] 回答1: No, this will not drop your table if there are indeed foreign keys referencing it. To get all foreign key relationships referencing your table, you could use this SQL (if you're on SQL Server

How can I set aspect ratio constraints programmatically in iOS?

陌路散爱 提交于 2019-12-17 10:48:50
问题 I have used auto layout for my view controllers. I have set the V and H positions in constraints, but I want to know how can I increase my button size when it changes to 5s, 6 and 6 Plus. This is the way I added constraints for the login button: NSArray *btncon_V=[NSLayoutConstraint constraintsWithVisualFormat:@"V:[btnLogin(40)]" options:0 metrics:nil views:viewsDictionary]; [btnLogin addConstraints:btncon_V]; NSArray *btncon_POS_H=[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-100-

How can I set aspect ratio constraints programmatically in iOS?

廉价感情. 提交于 2019-12-17 10:48:04
问题 I have used auto layout for my view controllers. I have set the V and H positions in constraints, but I want to know how can I increase my button size when it changes to 5s, 6 and 6 Plus. This is the way I added constraints for the login button: NSArray *btncon_V=[NSLayoutConstraint constraintsWithVisualFormat:@"V:[btnLogin(40)]" options:0 metrics:nil views:viewsDictionary]; [btnLogin addConstraints:btncon_V]; NSArray *btncon_POS_H=[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-100-