본문 바로가기
728x90
반응형

개발/sql49

oracle sql declarev_no emp.empno%type :=&res_no;v_cnt number;v_sal emp.sal%type;v_sal2 emp.sal%type :=0;beginselect count(*) into v_cnt from empwhere empno = v_no;if v_cnt =0 thendbms_output.put_line(v_no ||'는 없는 번호 입니다.');elseselect sal into v_sal from emp where empno=v_no;if v_sal >=4000 thenv_sal2 :=v_sal +400;elsif v_sal >=3000 thenv_sal2 :=v_sal +300;elsif v_sal >=2000 thenv_sal2 :=v_sal +200;elsev_sa.. 2015. 10. 5.
oracle test 및 답 1.INSERT INOT pReserve (unq,id,sDate,eDate,mCnt,rNum,app,rDate)VALUES('4','test4','2015-09-25','2015-09-27','2','3','N',sysdate); 2.서울에 사는 남자 회원 출력select * from pMember where addr like '%서울%' and gender='M'; 3.가장 최근에 등록한 회원 1명 출력(rownum적용)select id, name from (select id,name from pMember order by unq desc)where rownumto_char(sysdate,'YYYY/MM/DD'); 6.mlastInfo라는 컬럼명으로 출력(오늘 포함 숙박이 지난 회원 출력)select.. 2015. 9. 29.
oracle sql (1)variable month_sal number;declarev_sal number(8) :=1800;begin:month_sal :=v_sal/12;end;/print month_sal;---------------------------------(2)set serveroutput oned d:\test1.sqldeclare v_sal number(8) :=3000;month_sal number(8);beginmonth_sal :=v_sal/12;dbms_output.put_line('내 급여는'||to_char(month_sal));end;/set serveroutput on@test1.sql (3)declarev_deptno dept.deptno%type;v_dname dept.dname%type.. 2015. 9. 28.
oracle sql insert into pMember values('1','test1','1111','홍길동','010-2333-0100','서울','M');insert into pMember values('2','test2','1111','김민수','010-2333-3333','부산','M');insert into pMember values('3','test3','1111','박찬호','010-2314-0100','서울','M');insert into pMember values('4','test4','1114','이영희','010-2333-0100','대구','F');insert into pMember values('5','test5','1115','이진아','010-2551-5120','서울','F'); insert .. 2015. 9. 27.
728x90
반응형