SQL Multiple插入多行

时间:2017-07-15 18:31:07

标签: sql oracle

我正在尝试在没有指定列名的情况下向表中插入多行,但是,我在第一个逗号上得到一个错误,即它是一个部分识别的规则并且它给了我一个错误

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-param-var',
  templateUrl: './param-var.component.html',
  styleUrls: ['./param-var.component.scss']
})
export class ParamVarComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

  change(){

   var change = document.getElementById("oneseg");
                    if (change.innerHTML === "Desactivado")
                    {
                        change.innerHTML = "Activado";
                    }
                    else {
                        change.innerHTML = "Desactivado";
                    }
}

modo(value: string){
  switch(value) {
    case "mod1":
       console.log ("WORKS MODO 1");
       break;
    case "mod2":
        console.log ("WORKS MODO 2");
       break;
    case "mod3":
        console.log ("WORKS MODO 3");
       break;
  }
}

intGua(value : string) {
switch(value) {
    case "unCuarto":
       console.log ("WORKS 1/4");
       break;
    case "unOctavo":
        console.log ("WORKS 1/8");
       break;
    case "unDie":
        console.log ("WORKS 1/16");
       break;
    case "unTrein":
        console.log ("WORKS 1/32");
       break;
  }


}

}

2 个答案:

答案 0 :(得分:0)

试试这个;

INSERT INTO MY_EMPLOYEE(col1_name,col2_name,col3_name,col4_name,col5_name)
VALUES(126,'Popov', 'Olga', 'opopov', 8500), 
    (127, 'Chen', 'Ling', 'lcheng', 14500), 
    (128, 'Dunn', 'David', 'ddunn', NULL);

答案 1 :(得分:0)

我认为Oracle不支持VALUES多个记录。这是一个简单的替代方案:

INSERT INTO MY_EMPLOYEE
    SELECT 126,'Popov', 'Olga', 'opopov', 8500 FROM DUAL UNION ALL
    SELECT 127, 'Chen', 'Ling', 'lcheng', 14500 FROM DUAL UNION ALL 
    SELECT 128, 'Dunn', 'David', 'ddunn', NULL FROM DUAL;

注意:我强烈建议您指定插入列,但这是另一个问题。