Home | About SQeeL | Document | DownLoad | Mail Japanese
Home > Document > SQeeL Reference
A B C D E F G H I J L M N O P R S T U X Y  

C

  • Built-in variable
  • Built-in function
  • commit()
    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
    1:Success
    0:Fail
    System Return Value
    ERROR
    0Success
    100Oracle error
    DBERR
    文字列Database error number
    DBERRMSG
    文字列Database message
    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
    
    
    Topへ
    connect()
    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
    1:Success
    0:Fail
    System Return Value
    ERROR
    0Success
    1Argument error
    100Database error
    DBERR
    文字列Database error number
    DBERRMSG
    文字列Databese message
    DBUSER
    文字列Connected username to database
    See Also
    Requirements
    dboralib.slb
    Example
    require 'dboralib.slb'
    
    run()
    exit
    
    function run()
    
    	connect('scott/tiger')
    	logout()
    
    endfunction
    
    
    Topへ
    ceil()
    Description
    Returns the smallest value that is greater than or equal to an actual count
    Syntax
    ret = ceil(n)
    Parameters
    n:
    Return Value
    real number:Result
    0:Error or result
    System Return Value
    ERROR
    0Success
    1Argument error
    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
    
    
    Topへ
    CUR_SRC_DIR
    Description
    Directory on which the file that is currently executed is stored
    Read / Write
    r
    Type
    string
    initial value
    undefined
    Topへ
    close()
    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
    0:Error
    1:Success
    System Return Value
    ERROR
    0Success
    5File number error
    Example
    make_newfile()
    exit
    
    function make_newfile()
    
    	local fno
    
    	fno = open('foge.txt', new)
    		print('hello world', fno)
    	close(fno)
    
    endfunction
    
    Topへ
    count()
    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
    
    
    
    Topへ
    curtime()
    Description
    Returns the current time in the number of seconds since the epoch (00:00:00, January 1, 1970)
    Syntax
    ret = curtime()
    Return Value
    0 or more:Current time
    System Return Value
    ERROR
    0Success
    Example
    Topへ
    chr()
    Description
    Converts character code (e.g. a number, date) to a string
    Syntax
    ret = chr(n)
    Parameters
    n:Integer
    Return Value
    string:Converted character string
    System Return Value
    ERROR
    0Success
    1Argument error
    See Also
    Example
    //[result example]
    //
    //POPWEB
    //
    
    run()
    exit
    
    function run()
    	print(chr(0x50) & chr(0x4f) & chr(0x50) & chr(0x57) & chr(0x45) & chr(0x42))
    endfunction
    
    
    Topへ

    © Insight Technology, Inc. 1996-2003 All Rights Reserved.