insert into 테이블
select '2',   <--- column1 에 변경하고자 싶은 값을 넣어준다

  column2,

  column3,

  column4,

  column5,

  column6,

  column7

from 테이블 where CODE = '1'   <- 복사할 칼럼 조건을 넣어줌

'Programming > Oracle' 카테고리의 다른 글

DB 케릭터셋 확인하는 쿼리  (0) 2016.06.27
Decode는 like검색을 할 수 없다 하려면 case문으로  (0) 2016.03.09
where 1=1  (0) 2015.11.19

출처 : http://blog.daum.net/ippo22/15917845

 

onkeydown - 모든 키를 눌렀을때 (shift, alt, control, capslock 등의 키도 모두 인식한다. 단 한영변환, 한자 등의 특수키는 인식못함)

onkeyup - 모든 키를 눌렀다 땠을때 (onkeydown에서 인식하는 키들을 인식)

onkeypress - 실제로 글자가 써질때 (shift, enter 같은 키는 인식하지 못한다)

 

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

 

ie와 ff 계열 keyevent 차이

 

function mykey(e) {

  var keycode = '';

  if(window.event) keycode = window.event.keyCode;

  else if(e) keycode = e.which;

  else return;

  alert(keycode);

}

 

SELECT * FROM NLS_DATABASE_PARAMETERS

WHERE PARAMETER = 'NLS_CHARACTERSET'

decode(raw,'%법','1','2') 디코드는 이렇게 안된다.

하지만 case when raw like '%법' then '1' else '2' 가능

그리고 then 결과 값 앞에 이어 붙이거나 공백을 넣고 싶을땐

하지만 case when raw like '%법' then ' '||'1' else '2' || 이걸로 가능하다

'Programming > Oracle' 카테고리의 다른 글

동일 테이블에서 특정 컬럼값만 변경해서 복사 하기  (0) 2016.12.21
DB 케릭터셋 확인하는 쿼리  (0) 2016.06.27
where 1=1  (0) 2015.11.19

<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
    border: 1px solid black;
}
</style>
</head>
<body>

<table>
  <tr>
    <th>Month</th>
    <th>Savings</th>
    <th>Savings for holiday!</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
    <td rowspan="2">$50</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>

</body>
</html>

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

Month Savings Savings for holiday!
January $100 $50
February $80

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

rowspan은 셀 합치기 를 말한다 2는 row 즉 열 2개를 합치겠다는 의미

'Programming > Java' 카테고리의 다른 글

onkeypress  (0) 2016.02.15

<!DOCTYPE html>
<html>
<body>

<p>A function is triggered when the user is pressing a key in the input field.</p>

<input type="text" onkeypress="myFunction()">

<script>
function myFunction() {
    alert("You pressed a key inside the input field");
}
</script>

</body>
</html>

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

 A function is triggered when the user is pressing a key in the input field.

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

프레임 안에 키를 누를때마다 function의 기능이 실행 된다

'Programming > Java' 카테고리의 다른 글

rowspan  (0) 2016.02.15

where 1=1 은 항상 참인 조건

 

사용하는 이유는?

 - 편의성을 위해서

 - where 절은 고정적으로 넣어두고, 상황에 따라 and 절만을 추가하기 위해

   의미없는 조건절(항상 참인)을 맨 앞에 넣어주는 것.

 

예를 들어,

성별, 나이, 국적으로 사용자를 검색해야 한다면.

아래와 같은 여러가지 케이스가 나온다.

 

String sql = "select * from 사용자" ;

 if(조건)        sql = sql + " where 성별='남성' " ;

 else if(조건) sql = sql + " where 나이='20살' " ;

 else if(조건) sql = sql + " where 국적='한국' " ;

 else if(조건) sql = sql + " where 성별='남성' and 나이='20살' " ;

 else if(조건) sql = sql + " where 성별='남성' and 국적='한국' " ;

 else if(조건) sql = sql + " where 국적='한국' and 나이='20살' " ;

 else if(조건) sql = sql + " where 성별='남성' and 나이='20' and 국적='한국' " ;

 else            sql = sql + "" ;

 

 

이 때, where 1=1을 쿼리에 추가하면

조건문이 한결 간결해진다.

String sql = "select * from 사용자 where 1=1" ;

 if(조건) sql = sql + " and 성별='남성' " ;

 if(조건) sql = sql + " and 나이='20살' " ;

 if(조건) sql = sql + " and 국적='한국' " ;

[출처] [Oracle] where 1=1|작성자 치치포포

출처 : http://blog.naver.com/winter6120/220256057301

+ Recent posts