//아래의 C# 프로그램을 시작하기 전에 맨 아래의 Oracle 저장 함수를 먼저 만들어 주세요
using System;
using System.Data;
using Oracle.DataAccess;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
class Test
{
static void Main()
{
//get_dalary 함수는 Oracle에 정의 되어 있는 Stored Function 입니다.
//Empno와 같은 사원번호를 입력 인자로 받아 그 사원의 급여를 돌려 줍니다.
string str = "data source=uit;user id=scott; password=tiger";
OracleConnection Conn = new OracleConnection(str);
OracleCommand command = new OracleCommand("get_salary", Conn);
command.CommandType = CommandType.StoredProcedure;
OracleParameter output = new OracleParameter("sal", OracleDbType.Int64);
output.Direction = ParameterDirection.ReturnValue;
command.Parameters.Add(output);
OracleParameter input = new OracleParameter("p_id", OracleDbType.Int32);
input.Direction = ParameterDirection.Input;
input.Value = 7900;
command.Parameters.Add(input);
try
{
Conn.Open();
command.ExecuteNonQuery();
Conn.Close();
Console.WriteLine("{0}", output.Value);
Console.ReadLine();
}
catch(OracleException e)
{
Console.WriteLine(e.Number);
Console.WriteLine(e.Message);
Console.WriteLine();
}
}
}
![]() | ![]() ![]() | 12-27 | 1795 | |
![]() | ![]() ![]() | 12-11 | 1304 | |
53 | ![]() ![]() | 03-15 | 1050 | |
52 | ![]() ![]() | 01-31 | 1209 | |
51 | ![]() ![]() | 01-31 | 1008 | |
50 | ![]() ![]() | 01-31 | 904 | |
49 | ![]() ![]() | 01-19 | 1211 | |
48 | ![]() ![]() | 01-11 | 1071 | |
47 | ![]() ![]() | 01-03 | 1552 | |
46 | ![]() ![]() | 12-27 | 1795 | |
45 | ![]() ![]() | 12-19 | 1318 | |
44 | ![]() ![]() | 12-14 | 1311 | |
43 | ![]() ![]() | 12-11 | 1304 | |
42 | ![]() ![]() | 12-09 | 1049 | |
41 | ![]() ![]() | 12-01 | 1213 | |
40 | ![]() ![]() | 12-01 | 1423 | |
39 | ![]() ![]() | 12-01 | 927 |
댓글 없음:
댓글 쓰기