<< < 1 2 3 4 5 > >>   Sort: Rank

Pass a Cursor Variable to a Procedure in Oracle
How To Pass a Cursor Variable to a Procedure in Oracle? A cursor variable can be passed into a procedure like a normal variable. The sample script below gives you a good example: CREATE OR REPLACE PROCEDURE FYI_CENTER AS sys_cur SYS_REFCURSOR; PROCEDURE emp_print(cur SYS_REFCURSOR) AS emp_rec employ...
2018-07-18, 453👍, 0💬

Pass a Parameter to a Cursor in Oracle
How To Pass a Parameter to a Cursor in Oracle? When you define a cursor, you can set a formal parameter in the cursor. The formal parameter will be replaced by an actual parameter in the OPEN cursor statement. Here is a good example of a cursor with two parameters: CREATE OR REPLACE PROCEDURE FYI_CE...
2018-07-18, 400👍, 0💬

What Is NULL in PL/SQL in Oracle
What Is NULL in PL/SQL in Oracle? NULL is a reserved key word and it stands for two things in PL/SQL: NULL is an executable statement, and means doing nothing. NULL is a data value, and means no value. The following sample script shows you examples of using NULL keyword: DECLARE next_task CHAR(80); ...
2018-07-13, 491👍, 0💬

Test NULL Values in Oracle
How To Test NULL Values in Oracle? There ate two special comparison operators you can use on NULL values: "variable IS NULL" - Returns TRUE if the variable value is NULL. "variable IS NOT NULL" - Return TRUE if the variable value is not NULL. The following sample script shows you examples of compari...
2018-07-13, 424👍, 0💬

Use "WHILE" Loop Statements in Oracle
How To Use "WHILE" Loop Statements in Oracle? If you have a block of codes to be executed repeatedly based a condition, you can use the "WHILE ... LOOP" statement. Here is a sample script on WHILE statements: DECLARE total NUMBER; BEGIN total := 0; WHILE total &lt; 10 LOOP total := total+1; END ...
2018-07-13, 422👍, 0💬

Use "IF" Statements with Multiple Conditions in Oracle
How To Use "IF" Statements on Multiple Conditions in Oracle? If you have multiple blocks of codes to be executed based on different conditions, you can use the "IF ... ELSIF" statement. Here is a sample script on IF statements: DECLARE day VARCHAR2; BEGIN day := 'SUNDAY'; IF day = 'THURSDAY' THEN DB...
2018-07-13, 421👍, 0💬

Use "FOR" Loop Statements in Oracle
How To Use "FOR" Loop Statements in Oracle? If you have a block of codes to be executed repeatedly over a range of values, you can use the "FOR ... LOOP" statement. Here is a sample script on FOR statements: DECLARE total NUMBER := 0; BEGIN FOR i IN 1..10 LOOP total := total + i; END LOOP; DBMS_OUTP...
2018-07-13, 389👍, 0💬

Loading and Exporting Data in Oracle
Where to find answers to frequently asked questions on Loading and Exporting Data in Oracle? Here is a list of frequently asked questions and their answers compiled by FYIcenter.com DBA team on Loading and Exporting Data in Oracle. Clear answers are provided with tutorial exercises on saving data as...
2018-06-27, 570👍, 0💬

Simplest Tool to Run Commands on Oracle Server in Oracle
What Is the Simplest Tool to Run Commands on Oracle Servers in Oracle? The simplest tool to connect to an Oracle server and run commands to manage data is SQL*Plus. It is an Oracle database client tool that works as a command-line user interface to the database server. SQL*Plus allows you: Format, p...
2018-06-27, 493👍, 0💬

Quickest Way to Export Data to a Flat File in Oracle
What Is the Quickest Way to Export a Table to a Flat File in Oracle? The quickest way to export a table to a flat file is probably to use the SQL*Plus SPOOL command. It allows you to record SELECT query result to a text file on the operating system. The following tutorial exercise shows you how cont...
2018-06-27, 471👍, 0💬

Export Data with Field Delimiters in Oracle
How To Export Data with a Field Delimiter in Oracle? The previous exercise allows you to export data with fixed field lengths. If you want export data with variable field lengths and field delimiters, you can concatenate your fields with an expression in the SELECT clause as shown in the tutorial ex...
2018-06-27, 469👍, 0💬

Cursor Variable Easier to Use than Cursor in Oracle
Why Cursor Variables Are Easier to Use than Cursors in Oracle? Cursor variables are easier to use than cursors because: Cursor variables are easier to define. No need to give a specific query statement. Cursor variables are easier to open. You can specify the query dynamically at the time of open. C...
2018-06-27, 429👍, 0💬

What Is SQL*Loader in Oracle
What Is SQL*Loader in Oracle? SQL*Loader is a database tool that allows to load data from external files into database tables. SQL*Loader is available as part of the free Oracle 10g Expression Edition. It has some interesting features as: Can load data from multiple data files into multiple tables i...
2018-06-12, 514👍, 0💬

Start with a Minimum Initialization Parameter File in Oracle
How To Start Instance with a Minimal Initialization Parameter File in Oracle? The sample initialization parameter file provided by Oracle seems to be not working. But we can try to start the new instance with a minimal initialization parameter file (PFile). First you can create another PFile, $ORACL...
2018-05-08, 552👍, 0💬

Create a Server Parameter File in Oracle
How To Create a Server Parameter File in Oracle? This is Step 5. The initialization parameter file is good to get an Oracle database instance started. But it is not ideal run an instance as production. You need to convert the initialization parameter file into a Server Parameter File (SPFile) using ...
2018-05-08, 515👍, 0💬

Start a Specific Oracle Instance in Oracle
How To Start a Specific Oracle Instance in Oracle? A simple way to start a specific Oracle instance is to start the instance with the PFILE option as shown in the following example: &gt;.\bin\sqlplus /nolog SQL&gt; CONNECT / AS SYSDBA Connected. SQL&gt; STARTUP NOMOUNT PFILE=$ORACLE_HOME...
2018-05-08, 502👍, 0💬

Start an Oracle Instance in Oracle
How To Start an Oracle Instance in Oracle? This is Step 6. Now you are ready to start the new Oracle Instance without any database. This instance will be used to create a database. Starting an instance without database can be done by using STARTUP NOMOUNT statement as shown below: &gt;.\bin\sqlp...
2018-05-08, 462👍, 0💬

Run CREATE DATABASE Statement in Oracle
How To Run CREATE DATABASE Statement in Oracle? This is Step 7. Oracle Administrator Guide provided a sample CREATE DATABASE statement. But it is a long statement. You can modify and same it in a file, $ORACLE_HOME/configscripts/cre ate_database_fyi.sql,and run the file within SQL*Plus. Here is a co...
2018-05-08, 428👍, 0💬

Use an Explicit Cursor without OPEN Statements in Oracle
How To Use an Explicit Cursor without OPEN Statements in Oracle? If you want to open a cursor and loop through its data rows in quick way, you can use the FOR ... IN ... LOOP statement in the same way as the implicit cursor. The following tutorial exercise gives you a good example: CREATE OR REPLACE...
2018-04-07, 500👍, 0💬

Open Multiple Cursors at the Same Time in Oracle
Can Multiple Cursors Being Opened at the Same Time in Oracle? Yes, multiple cursors can be opened at the same time. See the following example: CREATE OR REPLACE PROCEDURE FYI_CENTER AS CURSOR emp_cur IS SELECT * FROM employees; emp_rec employees%ROWTYPE; CURSOR dpt_cur IS SELECT * FROM departments; ...
2018-04-07, 473👍, 0💬

Use FETCH Statement in a Loop in Oracle
How To Use FETCH Statement in a Loop in Oracle? If you have a cursor opened ready to use, you can also use the FETCH statement in a loop to retrieve data from the cursor more efficiently. But you need to remember to use an EXIT statement break the loop when the cursor pointer reaches the end. The sc...
2018-04-07, 465👍, 0💬

What Is a Cursor Variable in Oracle
What Is a Cursor Variable in Oracle? A cursor variable is a variable of a specific REF CURSOR data type, which is a pointer to a data structure resource connects to query statement result, similar to the CURSOR data type.. The advantage of using cursor variables is that cursor variables can be used ...
2018-04-07, 461👍, 0💬

Define a Sub Function in Oracle
How To Define a Sub Function in Oracle? A sub function is a function defined and used inside another procedure or function. You need to define a sub function in the declaration part of the enclosing procedure or function. Sub function definition starts with the FUNCTION key word. Here is a sample sc...
2018-03-18, 536👍, 0💬

Call Procedure or Function Recursively in Oracle
Can Sub Procedure/Function Be Called Recursively in Oracle? PL/SQL allows sub procedures or functions to be called recursively. The tutorial example below shows you how to calculate factorial values with a recursive sub function: SQL&gt; CREATE OR REPLACE PROCEDURE FACTORIAL_TEST AS 2 FUNCTION F...
2018-03-18, 491👍, 0💬

<< < 1 2 3 4 5 > >>   Sort: Rank