SQL & PL/SQL :: Declare And Set Parameters

Dec 22, 2010

the same query i put below but in oracle.

I'm trying to declare and set parameters in oracle

I'm trying to do something similar as the follow SQL Server Sentence:
------------------------------------------------------
DECLARE

@Year SMALLINT,
@City varchar(255)

SET @Year = 2010
SET @City = ''NY','NJ''

[Code]....

View 3 Replies


ADVERTISEMENT

SQL & PL/SQL :: Have Exception In Declare Block

Feb 20, 2012

Can we have any exception in DECLARE block (shown are just for example)?

Declare
exception occured
begin
code
end;

declare
variables;
begin
declare
variables;
begin
code;
end;
end;

View 6 Replies View Related

SQL & PL/SQL :: Declare Identifier In Oracle 10g?

May 22, 2013

When I am running script in oracle 10g ,getting error message as "PLS-00201: identifier 'UTL_SMTP' must be declared".

how to declare identifier 'UTL_SMTP' in oracle 10g or how to give execute access to current user

View 6 Replies View Related

SQL & PL/SQL :: Declare Returned Value - Getting Error

Jan 28, 2013

while trying to execute this

declare ret_val number;
begin
exec p_buildinfo('252657020001', to_date('20120820','YYYYMMDD'),to_date('20120928','YYYYMMDD'),ret_val, 0);
DBMS_OUTPUT.PUT_LINE('Value Returned Is : '||ret_val) ;
end;

I getting the below error

ORA-06550: line 3, column 10:
PLS-00103: Encountered the symbol "P_BUILDINFO" when expecting one of the following:

:= . ( @ % ;
The symbol ":=" was substituted for "P_BUILDINFO" to continue.

the procedure structure is

CREATE OR REPLACE
PROCEDURE p_buildsinfo ( var_p_cod CHAR := NULL,
var_p_dat_from DATE := NULL,
var_p_dat_to DATE := NULL,
po_var_l_nxt_seq IN OUT NUMBER,
var_p_consol_flg NUMBER default 0
)

View 14 Replies View Related

SQL & PL/SQL :: Error On DECLARE Statement?

Dec 19, 2011

I am getting an error when trying to run this DECLARE statement and I'm not sure why. I'm fairly new to PL/SQL and have looked up how to format a DECLARE statement and this seems right to me.

DECLARE

v_eventstart date;
v_maxhbdate date;
v_6monthPOS date;

[code]...

The error is stating "encountered the symbol "end-of-file" when expecting one of the following... " and is refering to the beginning of this statement.

View 6 Replies View Related

PL/SQL :: Declare Variable As Row Type For A Table?

Jul 19, 2012

Can I declear a variable in PLSQL as the row type for a table, who's name is unknown during compile time, but will be determined when the PLSQL is runnning. The code is like following:

Procedure operTable( tableName IN VARCHAR2)
IS
TYPE ty_Row IS tableName%ROWTYPE
v_Row ty_Row;
CURSOR v_quey_cur

[code]...

View 5 Replies View Related

PL/SQL :: Declare Variable In Stored Procedure

Dec 21, 2012

how do you declare a variable in a store procedure

View 11 Replies View Related

SQL & PL/SQL :: Declare A User Define Exception Name As Per Defined Name?

Jan 25, 2011

Can we able to declare a user define exception name as per defined exception name?Ex: we have predefined exception called :"NO_DATA_FOUND "

Now in my PL/SQL block can i able to declare "NO_DATA_FOUND" like

Begin
no_data_found exception;
//statements
raise no_data_found;
end

View 6 Replies View Related

SQL & PL/SQL :: Difference Between Variables Declared Under Begin And Declare?

Feb 24, 2013

i just what to understand the differnce between the variable declared under the Begin and variable declared under Declared. to understand this i tried a sample plsql procedure as show below

create or replace
PACKAGE BODY TEST_DEV AS
PROCEDURE TESTING(I_NAME VARCHAR2,
I_AGE NUMBER) AS
INTEGE binary_integer := 100;
[Code] .......

the Line L_nums1 NUMBER := 100/0; is throwing error(PLS-00103: Encountered the symbol "NUMBER" when expecting one of the following:)

if i remove the line L_nums1 NUMBER := 100/0; and just declare the variable out side the begin , and using inside the same variable inside the begin works fine

Why question is why we are not able to decalre, initialize and use the same Number variable insde the begin

View 4 Replies View Related

SQL & PL/SQL :: How To Declare A Variable Which Reference Level Type

Aug 5, 2010

I have a problem :

In package head I declare a variable , which reference 'level' type , but I don't know how to declare the variable , because I don't know what type of 'level'.

View 9 Replies View Related

Forms :: How To Declare Global Variable And Call Same In Other Form

Oct 6, 2008

I want to call a value from one from to another form in d2k forms 4.5. I think this can be done only by declaring a global variable. I don't know how to declare global variable and also calling the same in other forms.

View 14 Replies View Related

SQL & PL/SQL :: How To Declare Global Variable In Package Body (Not Spec)

Feb 26, 2013

I want to know how we can declare a Global Variable in Package body(Not Spec), So that i can use it in any procedures or function(Defined in same package).

View 11 Replies View Related

SQL & PL/SQL :: Hide Declaration Or Declare It Inside The Body Of Package

Mar 11, 2010

I have a package which has couple of Procedures and functions. I use some constants between the functions and procedure and also functions r called from the other procedure and stuff...

So I declared all these in the header

Like this

CREATE OR REPLACE PACKAGE "PROCESS_HISTORY" IS
type table_name_i is varray(100) of VARCHAR2(30);
c_add constant number := 1;
c_del constant number := 2;
c_select_frm_tmp constant number := 1;
[code]......

Now is there anyway I could hide the stuff that I don't want outside people to see? or can I declare them (constants and some functions) some where inside the body and use them?

View 9 Replies View Related

Precompilers, OCI & OCCI :: Variable Declarations In DECLARE SECTION?

Mar 9, 2010

I am getting some odd results from a Database Insert Function. The function receives an Array of elements. The elements are a defined structure (containing around 21 data items). I need to insert these records into an Oracle table.For each element of the Array the function reads the structure into a local c structure of the same type.

I then go through this local structure and get a copy of the data into local variables declared in the EXEC SQL BEGIN DECLARE SECTION of the function. I then use the local vars to do the insert, using null INDICATOR variable to handle those variables that could be empty. The local variables look like this....

EXEC SQL BEGIN DECLARE SECTION;
int dbServiceTypeId;
int dbRecordType;
char dbRbmCustRef[MAX_CUST_REF_LEN];
int dbServiceSeq;

[code]...

BUT.. when I uncomment the dbCOS variable (even though I don't populate it or try to include it in the insert) I get the following in the table (The RATE value goes missing completely and the multiplier is wrong)...

ID SERVICE CODE R/T RATE MULTI
41325-SCODE-1084 1 542139762
11326-SCODE-1086 1 542139762
11326-SCODE-1086 2 542139762
21327-SCODE-1087 1 542139762
21327-SCODE-1087 2 542139762
21327-SCODE-1087 3 542139762
21327-SCODE-1087 3 542139762

However, a printf statement just before the insert based that returns the variables shows the following...

Service Type ID: '4'
Record Type ID: '1'
Service Cust Ref: '1325-SCODE-1084'
Service Unit Rate: '1200.00'

Indeed, for this record the Multiplier doesn't even get populated. The other odd thing is if I recomment the dbCOS but remove the dbOraDateFmt variable definitions, it corrupts the data again, though different fields. I can't understand why individual local variables are behaving this way. Is this a problem with the way variables are declared in this section?

View 3 Replies View Related

Forms :: Declare Message For @ Is Not Type In Email Address

Oct 24, 2011

i want if user is not type the @ in email text box than from show the message "check your email address" but i cant do that

declare
ok_flag number :=0;
begin
ok_flag :=instr('emailaddress','@');
if
ok_flag < 1 then
message('invalid email');
else
message('thanks');
end if;
end;

View 8 Replies View Related

SQL & PL/SQL :: Declare Date Variable And Assign It To Current System Date

Apr 19, 2011

Write a program to declare a date variable and assign it to the current system date. Depending on the day of the month the program should print the following:

If day is 1-10 then print "It is day<day number> of <month name>. It is early in the month".
If day is 11-20 then print "It is day<day number> of <month name>. It is the middle of the month".
If day is 21-31 then print "It is day<day number> of <month name>. It is nearly the end of the month".

For example, if the day is November 30, then print "It is day 30 of November. It is nearly the end of the month".

View 9 Replies View Related

Get Parameters Only Specify To SQL

Jun 14, 2013

Oracle Version:11.2.0.3/ OEL 6.1 

For diagnosing a performance issue related to a batch run, our application teams wants to know all session/system level parameter that affects SQL performance.  I can't simply give an output of v$parameter.name and v$parameter.

value as there will lots of parameter not related SQL performance like  

diagnostic_destlog_archive_dest_1deferred_segment_creationcontrol_filesbackground_core_dump 

I am looking for only those parameters which are relevant to SQL performance, like

optimizer_modestatistics_levelmemory_targetsga_target

View 2 Replies View Related

SQL & PL/SQL :: How To Use Pivot With Parameters

Apr 16, 2013

How can you use pivot with a parameter? If you attempt to use a parameter then an ORA-500: bind variable not supported is given

Below is a simplified version of the sql to illustrate teh problem.

create table test_pivot
(
ord_no number,
qty number,
loc varchar2(10)
):
insert into test_pivot values (123, 3, 'LOC1');
insert into test_pivot values (123, 2, 'LOC1');
insert into test_pivot values (234, 4, 'LOC1');
insert into test_pivot values (234, 5, 'LOC1');

-- this one is fine

Select * From
(
Select Ord_No, Qty, Loc
From Test_Pivot
Where Ord_No In ('123', '234')
)
Pivot (Sum(Qty) For Ord_No In ('123', '234') )

-- how to use pivot with parameters

Select * From
(
Select Ord_No, Qty, Loc
From Test_Pivot
Where Ord_No In (:Ord1, :Ord2)
)
Pivot (Sum(Qty) For Ord_No In (:Ord1, :Ord2) )

View 4 Replies View Related

Forms :: How To Use Parameters

Nov 21, 2011

I want to ask that how can I use parameters in forms? I have created 2 parameter pm_rollnum and pm_classname but I don't that how I use it in form that when end user enter its value in these parameter result should be open.

View 6 Replies View Related

SQL & PL/SQL :: Nls-session-parameters?

Sep 26, 2011

I just upgraded my version of my oracle from 9 to 11.2g.When I tried to execute some queries in PL/SQL i keep getting an
annoying error : "ORA-01843 not a valid month."

I realized that if I execute the following query:alter session set NLS_DATE_LANGUAGE=AMERICAN;before every query that I want to execute, then it's executed fine.

I preformed the next queries:
1. select * from nls_database_parameters;
2. select * from nls_instance_parameters;
3. select * from nls_session_parameters;

and I saw that the fields in the "nls_session_parameters" vieware not derived from "nls_database_parameters" "nls_instance_parameters".

How can I derive the parameters from the instancedatabase view into the session view?I want that the "nls_date_language" parameter will always be 'AMERICAN'.

View 3 Replies View Related

SQL & PL/SQL :: Parameters With In Clause

Oct 17, 2011

How to how to get this sql to work?

select a.in_house_ref
from media_item a
where
((&rack is null) or a.in_house_ref in (&rack));
--a.house_media in ('CH127600','BF101042'), example values

I've tried the a.in_house_ref in (:rack) by itself and that doesn't work for the values above and hence changed it to (&rack) and that works. The issue I run into now is that the the paramater can be null, ie., no values need be entered by users and hence I put the is null statement. When I run the full statement above, oracle returns an error, i.e. , ORA-00936: missing expression.

View 7 Replies View Related

Purpose Of Kernel Parameters

Aug 26, 2011

what is the purpose of kernel parameter while creating database.

View 1 Replies View Related

How To Use Parameters In Plsql Procedure

Oct 21, 2010

I have excel file which I am reading through plsql procedure using UTL_FILE utilities, one of the column in the excel has multiple values in the same column, I am getting the values into plsql, but when it is coming to where clause its not working.

Example:
in excel the column has : 'ABC','GEH','HGT',LTP'

create or replace procedure abc(temp_col varchar2)
.
....
....
...
SELECT COLA, COLB, COLC
FROM TABLE_TEMP
WHERE TCOL IN temp_col;

This is not working, if the column in excel has one value say ('ABC') then the above sql is working, if it has more than one value its not working.

View 2 Replies View Related

Function With Null Parameters

Mar 17, 2009

i have a function which takes in two variables and return a varchar.

ex: Function(var1,var2) return as varchar2.

in the function,i query a table for var1 and var2 and concatenate the result set to return a varchar. But if either var1 or var2 is null,then my query in the function fetches the result set for the other variable.

My question is,how would i pass a null value through the function and handle it in the function.

View 1 Replies View Related

Function Return Parameters

Dec 5, 2006

The function definition in PL/SQL has IN OUT parameter as well as return statement. Using both we can return the values. Basic definition of a function is function can return only one value at a time.

The question is, Can we return a number thru return statement and a char value thru INOUT parameter. Is it possible to return two different values using these?

View 1 Replies View Related

Extract DDL's Without Storage Parameters?

May 11, 2005

I need to extract DDL's without storage parameters. if i use the export and import using indexfile or if i try to extract using the DBMS_METADATA.GET_DDL package , in both ways my output is with the storage parameters

eg:
CREATE TABLE "SEPT"
( "DEPTNO" NUMBER(2,0),
"DNAME" VARCHAR2(14),

[Code].....

View 6 Replies View Related

SQL & PL/SQL :: Using NVL Function With Parameters In A Procedure?

May 16, 2011

I am currently studying a Foundation degree in computer software development, and one of my assignment in PL/SQL I am stuck on one of the tasks.

I have to create a procedure where one of the parameters needs to have a default value of one, if no value is entered when the procedure is called. I have trued to use the NVL function which worked when using a anonymous block, but now I have to convert that to a procedure. My problem is I'm getting an error.

The code for the procedure is

CREATE OR REPLACE PROCEDURE add_new_classes
(p_number_of_classes NUMBER := NVL(NULL,1), -- This will enter a default value of 1 if the user does not specify a number
p_course_id classes.course_id%TYPE,
p_period classes.period%TYPE,
p_frequency classes.frequency%TYPE,

[code]....

I then use this to test it

BEGIN
add_new_classes(1002,'first','daily',3002);
END;

and the error I get is

Quote:ORA-06550: line 2, column 4:
PLS-00306: wrong number or types of arguments in call to 'ADD_NEW_CLASSES'
ORA-06550: line 2, column 4:
PL/SQL: Statement ignored
1. BEGIN
2. add_new_classes(1002,'first','daily',3002);
3. END;

View 5 Replies View Related

SQL & PL/SQL :: Calling A Function With Parameters?

Feb 27, 2011

When I replace the params manualy with dates in format of:

'27-feb-2011 08:00:00'

I get the real output.

But when I call the function with the TEST button in the PLSQL I don't get any output (Empty table).

Here is the original function (Bad output) and attaching a file with manuly added dates (Good output):

FUNCTION WhatRoomsTaken(dStartTime date, dEndTime date, dEventDate date)
RETURN Genrefcursor IS
Retval Genrefcursor;
BEGIN
open Retval for

[code].....

Why do I need to change in order to get the good output by calling the function with params?

View 5 Replies View Related

SQL & PL/SQL :: How To Pass Timestamp Parameters

Sep 13, 2013

In my task I am trying to pass a timestamp datatype as one of the input parameter to a procedure in the package.But I am not sure how to give data for it while executing and testing it from anonymous block.

CREATE OR REPLACE
PACKAGE body ac
IS
PROCEDURE ac_ex_wbdb_keycats(
In_Sale_Location_Id IN NUMBER,
In_Start_Datatime IN TIMESTAMP,
In_Stop_Datatime IN TIMESTAMP,
v_refcur OUT sys_refcursor)

[code]....

View 2 Replies View Related

SQL & PL/SQL :: Created One Procedure With 4 In Parameters

Aug 20, 2013

i created one procedure with 4 in parameters and 1 out parameters(return the value) but whenever execute this procedure i got the error i.e pl/sql: Compilation unit analysis terminated.

PLS-00201:identifier T_USER_PLDATA' must be declared.

CREATE OR REPLACE PROCEDURE GET_USER_PLDATA1( V_PROD_LINE_CD IN VARCHAR2,
V_BUS_GROUP_CD IN VARCHAR2,
V_BUS_UNIT_CD IN VARCHAR2,
V_COUNTRY_CD IN VARCHAR2,
V_USER_PLDATA OUT T_USER_PLDATA)[c
[code]....

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved