
Description
Commits the DML statements (SELECT, INSERT, UPDATE or DELETE)
The current transaction is rolled back when you execute the logout() or the exit statement

Syntax
ret = commit()

Return Value

System Return Value
ERROR
DBERR
DBERRMSG
DBUSER
| 文字列 | | Connected username to database |

Requirements
dboralib.slb

Example
require 'dboralib.slb'
function run()
connect( 'scott/tiger' )
sql insert into DEPT (DEPTNO, DNAME, LOC) values (50, 'LOGISTICS', 'LOS ANGELES');
if DBERR != 0
rollback
else
commit
endif
logout
endfunction
//fetch//
function run2()
local dept
connect scott/tiger
sql select DEPTNO, DNAME, LOC from DEPT;
if DBERR eq 0
dept = fetch(0)
print('DEPT table has '&count(dept)&' data',stdout)
else
print(DBERRMSG,stdout)
endif
logout
endfunction
//sqlformat//
//sqlprint//
function run3()
connect scott/tiger
sql select DEPTNO, DNAME, LOC from DEPT;
if DBERR eq 0
sqlformat(10,10,10)
sqlprint(0,stdout)
else
print(DBERRMSG,stdout)
endif
logout
endfunction
//plsql//
function run4()
connect scott/tiger
plsql dbms_stats.gather_schema_stats('scott');
if DBERR != 0
print(DBERRMSG,stdout)
endif
logout
endfunction

Description
Connects a given username to the database
A username and password are included in a CONNECT command
You need to enter a slash (/) between a username and password
If you include a connect identifier, such as the node name or database, you can enter them with a at mark sign (@) after the password.

Syntax
ret = connect(connect_string)

Parameters
| connect_string | : | Connect character string |

Return Value

System Return Value
ERROR
| 0 | | Success |
| 1 | | Argument error |
| 100 | | Database error |
DBERR
DBERRMSG
DBUSER
| 文字列 | | Connected username to database |

See Also

Requirements
dboralib.slb

Example
require 'dboralib.slb'
run()
exit
function run()
connect('scott/tiger')
logout()
endfunction

Description
Returns the smallest value that is greater than or equal to an actual count

Syntax
ret = ceil(n)

Parameters

Return Value
| real number | : | Result | |
| 0 | : | Error or result | |

System Return Value

Example
//[result example]
//
// input number:2.759
// ceil(2.759) = 3
exit get_ceil()
function get_ceil()
local input = 0
input = getopt('input number: ')
print("ceil("&input&") = "& ceil(input) )
endfunction

Description
Directory on which the file that is currently executed is stored

Read / Write
r

Type
string

initial value
undefined

Description
Closes file specified by a file ID argument

Syntax
ret = close(filehandle)

Parameters
| filehandle | : | File number Default: all file numbers that are currently open |

Return Value

System Return Value
ERROR
| 0 | | Success |
| 5 | | File number error |

Example
make_newfile()
exit
function make_newfile()
local fno
fno = open('foge.txt', new)
print('hello world', fno)
close(fno)
endfunction

Description
Returns the number of elements of array variable

Syntax
ret = count(array)

Parameters
| array | : | Array to check the size |

Return Value
| 0 or more | : | Number of elements in an array | |
| -1 | : | Not an array | |

Example
//[result example]
//
// --------------------------------
// a_array[0] => elem1
// a_array[1] => elem2
// a_array[2] => elem3
//
// *** n_count = count(a_array) ***
//
// n_count => 3
// --------------------------------
//
run()
exit(0)
function run()
local a_array = { 'elem1', 'elem2', 'elem3' }
local n_count
local i
print("--------------------------------", stdout)
loop i=0; i<count(a_array); i++
print("a_array[" & i & "] => " & a_array[i], stdout)
endloop
print("\n*** n_count = count(a_array) ***\n", stdout)
// count
n_count = count(a_array)
print("n_count => " & n_count, stdout)
print("--------------------------------", stdout)
endfunction

Description
Returns the current time in the number of seconds since the epoch (00:00:00, January 1, 1970)

Syntax
ret = curtime()

Return Value

System Return Value

Example

Description
Converts character code (e.g. a number, date) to a string

Syntax
ret = chr(n)

Parameters

Return Value
| string | : | Converted character string | |

System Return Value

See Also

Example
//[result example]
//
//POPWEB
//
run()
exit
function run()
print(chr(0x50) & chr(0x4f) & chr(0x50) & chr(0x57) & chr(0x45) & chr(0x42))
endfunction