# @n123al/oraclesql

> Connect to an Oraclesql-SQL server and run queries using a simple API

Latest version **0.1.6** (published 2024-09-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @n123al/oraclesql
pnpm add @n123al/oraclesql
yarn add @n123al/oraclesql
bun add @n123al/oraclesql
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.6 |
| Published | 2024-09-30 |
| First published | 2019-05-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 3 |
| Unpacked size | 25.6 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| Author | Nick |
| Maintainers | n123al |
| Keywords | database, oraclesqlsql, sql, oraclesql, node-sqlserver, node-oraclesqlsql |

## Links

- npm: https://www.npmjs.com/package/@n123al/oraclesql
- Repository: https://github.com/n123al/oraclesql
- Issues: https://github.com/n123al/oraclesql/issues
- npm.io page: https://npm.io/package/@n123al/oraclesql

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [oracledb](https://npm.io/package/oracledb.md) ^4.2.0
- [@types/oracledb](https://npm.io/package/@types/oracledb.md) ^4.2.0

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 0.1.6 (latest) — 2024-09-30
- 0.1.5 — 2024-09-30
- 0.1.4 — 2024-09-30
- 0.1.3 — 2024-09-30
- 0.1.2 — 2024-09-30
- 0.1.1 — 2024-09-30
- 0.0.17 — 2024-09-30
- 0.0.1-6.1 — 2024-09-30
- 0.0.16 — 2020-04-30
- 0.0.1-5.1 — 2020-04-22
- 0.0.15 — 2020-04-22
- 0.0.14 — 2020-04-22
- 0.0.13 — 2019-11-11
- 0.0.12 — 2019-07-23
- 0.0.11 — 2019-07-23
- … 10 more at https://npm.io/package/@n123al/oraclesql/versions

## README

# Connect to an Oracle-SQL server and run queries using a simple API

A simple way to run SQL queries using Async/Await and Promises. This is not an ORM.  
It uses node-mssql under the hood

## Installation

```bash
npm install @n123al/oraclesql
```

## initialization

```typescript
import { SqlConfig, sqlInit } from '@n123al/oraclesql';
const sqlConfig: SqlConfig = {
    user: 'sa',
    password: 'password',
    server: 'localhost',
    database: 'AdventureWorks'
};
sqlInit(sqlConfig);
```

## Usage

> The first parameter is the SQL query to execute. Use @P1, @P2 for parameter values.
> the rest parameters are the values for the parameters (The first one will replace @P1, the second will replace @P2 and so on)

```typescript
import { sql } from '@n123al/oraclesql';
sql
    .query('SELECT * FROM USERS WHERE name like @P1 AND isActive = @P2', 'John%', true)
    .then(data => console.log(data))
    .catch(error => console.error(error));
```

### using Async / Await

```typescript
try {
    const data = await sql.query('SELECT * FROM USERS WHERE name like @P1 AND isActive = @P2', 'John%', true);
} catch (error) {
    console.log(error);
}
```

### Methods

*   sql.query (alias: sql.q): Executes query and returns an array with the results. Can be used for any query types
*   sql.queryOne (alias: sql.1): Executes the query and returns the first record, or null if there are no records
*   sql.insertReturnIdentity (alias: sql.ii): Can be used for INSERT. It will return the identity of the inserted record (i.e. SCOPE_IDENTITY()) or null

---
_Source: https://npm.io/package/@n123al/oraclesql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
