使用OTL对oracle数据库进行增加,删除,编辑和查询操作。

本文展示了如何使用OTL库在Oracle数据库上执行基本的CRUD操作,包括插入数据、删除特定条件的记录、更新记录以及查询数据。通过示例代码详细说明了OTL连接数据库、执行SQL语句的过程。
摘要由CSDN通过智能技术生成


#include "stdafx.h"
#include <iostream>
using namespace std;

#include <stdio.h>
//#define OTL_ORA10G
#define OTL_ORA9I // Compile OTL 4.0/OCI9i
#define OTL_ORA_UTF8 // Enable UTF8 OTL for OCI9i
#include <otlv4.h> // include the OTL 4.0 header file
#pragma comment(lib, "oci.lib")
otl_connect db; // connect object
#define CONNECTSTRING "test/12345@192.168.1.202"

char strSelectSql[100]  = { "select f1,f2,f3 from test_tab"};
char strDeleteSql[100]  = { "delete from test_tab where f1 = '4' "};
char strUpdate[150]     = { "update test_tab set f2 = 'Olympiad in china' , f3 = to_date('2008-08-08 08:08:08','yyyy-mm-dd hh24:mi:ss') where f1 = 5 "};
void insert()
{

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值