SQL & PL/SQL :: Decode Functionality With Null

Jun 29, 2010

Explain me the following behavior of DECODE?

SQL> select decode(null,null,'Matched','Not Matched') from dual;

DECODE(
-------
Matched
As expected, output should be 'Not Matched' instead of 'Matched'

View 10 Replies


ADVERTISEMENT

SQL & PL/SQL :: Decode Functionality In DBMS_OUTPUT

Jun 28, 2010

I would like to use the below decode in DBMS_OUTPUT in place of cur_rec.data_type. Could I know how can I achieve this.
The DBMS_OUTPUT is inside a loop and output is shown below as an example.

NOT NULL -- EMP_ID NUMBER
,NOT NULL -- EMP_NAME NUMBER
,NOT NULL -- HIRE_DT DATE
,NOT NULL -- SALARY NUMBER

DBMS_OUTPUT STMT:

Dbms_Output.Put_Line(nullable ||CHR(9)||CHR(9)||' -- ' ||upper(cur_rec.column_name)||CHR(9)||CHR(9)||cur_rec.data_type);

STMT to use in place of cur_rec.data_type:

substr(decode( data_type, 'NUMBER', decode( data_precision, NULL, NULL,'('||data_precision||','||data_scale||')' ),data_length),1,11)

Also I am not able to align the output using CHR(9).

View 14 Replies View Related

SQL & PL/SQL :: How To Use NOT NULL Inside DECODE

Jun 28, 2007

DECODE(FIELD_1,NOT NULL,'working',NULL)

Is it possible to do such? else how to proceed so?

View 9 Replies View Related

SQL & PL/SQL :: Using NULL And DECODE In Dynamic Query

Sep 2, 2011

small piece of PL SQL code. how to make this query.Requirement is that a concurrent program is run with parameters and one of them i_num_org_id is non mandatory so it can come as NULL...Now in an existing code which i have to change, it uses a query as

SELECT xyz
FROM abc_table
WHERE <various conditions>
AND DECODE(i_num_org_id,NULL,1,table.organization_id) = NVL(i_num_org_id,1);

Now with the above way, if the program is run with some value for i_num_org_id or run as normal query (with NULL as the value) inside a PLSQL procedure/package then it runs fine.This query if you run in Toad etc then too it will work fine but if it is made a dynamic SQL and then used as either EXECUTE IMMEDIATE or opened as a cursor then we get a "Missing expression". I created this small anonymous block to test this and this will go into missing expression error

declare
l_num_org_id NUMBER := NULL;
l_temp VARCHAR2(100);
l_sql varchar2(1000);
begin
l_sql := 'SELECT '||''''||'abcd'||''''||'
[code].....

how i can reformat this query so that even if NULL value comes for i_num_org_id then it is handled.I am aware about CASE but that cannot be used in WHERE clause i guess.

View 10 Replies View Related

SQL & PL/SQL :: Hierarchical Query - Connect NON-NULL Rows To Preceding NULL Row

Aug 29, 2012

I have the following query:

select col_1,col_9 from
book_temp b
where b.col_1 is not null
order by to_number(b.col_16)
;

What I want to add is the following:

COL_9
=====
NULL
A
B
NULL
C
D
E
F
NULL
G

I need to connect the NON-NULL rows to the preceding NULL row.

View 15 Replies View Related

PL/SQL :: OUT Parameter Functionality

Mar 25, 2013

I thought that you are not supposed to be able to assign the value of an out parameter to a variable (Feuerstein, 5th ed) and yet I was just
able to do this without any compilation error messages. Is Feuerstein wrong or am I missing something? Has the functionality changed?

PROCEDURE Parse_HC
          (p_timestamp_string IN VARCHAR2,
          p_timestamp_date OUT DATE)
AS
v_date DATE;

[Code]....

Here is my banner:

BANNER
----------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 – Production
"CORE     11.1.0.7.0     Production"
TNS for Linux: Version 11.1.0.7.0 – Production
NLSRTL Version 11.1.0.7.0 - Production

View 8 Replies View Related

SQL & PL/SQL :: Counting NULL Vs NON-NULL In A GROUP BY Clause

Jun 21, 2010

I am running a GROUP BY query on a few columns of enumerated data like:

select count(*), Condition, Size
group by Condition, Size;

COUNT(*) CONDITION SIZE
-------- ---------- --------
3 MINT L
2 FAIR L
4 FAIR M
1 MINT S

Well, let's say I also have a timestamp field in the database. I cannot run a group by with that involved because the time is recorded to the milisec and is unique for every record. Instead, I want to include this in my group by function based on whether or not it is NULL.

For example:

COUNT(*) CONDITION SIZE SOLDDATE
-------- ---------- -------- ----------
3 MINT L ISNULL
2 FAIR L NOTNULL
2 FAIR M NOTNULL
2 FAIR M ISNULL
1 MINT S ISNULL

View 9 Replies View Related

SQL & PL/SQL :: Date Field - Not Null Column To NULL

Mar 16, 2011

I have a table which has a not null column. the column is date field. I am trying to change it to Null. But it is giving a error.

I am using below query.

ALTER TABLE T_test
modify (paid_to_date null)

View 9 Replies View Related

Stream Functionality Replacement In 11g

Dec 15, 2010

Earlier I am using oracle 10g (10.2.0.4) and now we are planning to use 11gR2 (11.2.0.1).we are using oracle stream functionality in 10g. I just want to know is there any new feautre available in 11g which replace the stream functionality? we dont want to use stream (in 11g) any more.

View 3 Replies View Related

Forms :: GET_FILE_NAME Functionality

Mar 8, 2010

I have my forms application working on both windows and Unix platform. When i am using GET_FILE_NAME ( ), it is working fine in Windows based application but the same is not working in Unix based application..

View 11 Replies View Related

Forms :: JTF Grid Functionality

Sep 12, 2009

what is JTF GRID functionality,i have use that grid in custom form. how to proceed with that and what are steps to be taken to display JTF GRID Functionality ?

View 6 Replies View Related

SQL & PL/SQL :: Procedure Functionality As Triggers

Oct 26, 2010

I am creating triggers for audit operation when any insert/update/delete happens on a table automatically.Now i need the same functionality in procedure.

My requirement is to create procedure for all those triggers.

View 2 Replies View Related

DATE-ADD In Oracle - Convert Functionality?

Oct 28, 2011

I need to convert below functionality in Oracle. At present it is working with SQL server

current_end_time TIMESTAMP,
current_start_time TIMESTAMP
current_duration int
current_end_time := DATEADD(second, current_duration/10, current_start_time)

View 1 Replies View Related

PL/SQL :: Replicate For Loop Functionality Through SQL Query

Jun 14, 2013

I have a requirement where i need to replicate the for loop functionality  through sql query.In pl/sql  i can achieve this through cursors or for loop but is there any way  to do  or replicate the same functionality in sql queries .  For example i want to repeat the  operation for  set of records  or iterate through set of records and fire query accordingly .Is it possible  through sql query

View 19 Replies View Related

Forms :: Restrict Standard Save Functionality?

Jun 20, 2011

how can we restrict standard save button functionality in custom form?

View 4 Replies View Related

Forms :: Auto Stretch Functionality In Oracle?

Oct 6, 2013

Is it possible to have auto stretch functionality (similar to Oracle ADF) in Oracle Forms?

The requirement is to adjust the data blocks/ canvases according to the window size automatically.

I know it is possible in Oracle ADF. But I want to achieve the similar kind of functionality in Oracle Forms.

View 1 Replies View Related

Client Tools :: Access Violation And F4 Functionality

Jan 14, 2012

I am using the Toad10.After i enter the user, Pwd it displays the Toad error that""Access violation at address 6761CB21 in module 'ORA805.dll'. Read of address 00000010 ""

while i try to use the F4 functionality, it again displays the above msg and Object not found...After i execute the query, all the characters data displays in chinees.

View 1 Replies View Related

SQL & PL/SQL :: Unique Null And Multiple Non-null

Oct 24, 2013

create table test
(
id int ,
dat date
)
/

I want to implement a business rule such as we have for each id at most 1 dat null. So, I've created this unique index on test.

create unique index x_only_one_dat_cess_null on test(id, case when dat_cess is null then 'NULL' else to_char(dat_cess, 'dd/mm/yyyy') end);

insert into test values (1, sysdate);
insert into test values (1, sysdate - 1);
insert into test values (1, null);
insert into test values (1, null);
-- -----
insert into test values (2, sysdate);
insert into test values (2, sysdate - 1);
insert into test values (2, null);

The 4th insert will cause an error and this is what I wanted to implement. OK. Now the problem is that for non-null values of dat, we can't have data like this

iddat
------------
124/10/2013
123/10/2013
123/10/2013
1

because of the unique index (the 2nd and the 3rd row are equal). So just for learning purposes, how could we allow at most one null value of dat and allow duplicates for non-null values of dat.

View 2 Replies View Related

SQL & PL/SQL :: How To Modify Null Column To Not Null

Jan 9, 2012

when i follow this steps mention on this website

[URL].........

to modify column from null to not null i got this error and on this website its show successful

my steps are

first i create a table

SQL> create table Stu_Table(Stu_Id varchar(2), Stu_Name varchar(10),
2 Stu_Class varchar(10));

Table created.

Then insert some rows into Stu_Table

SQL> insert into Stu_Table (Stu_Id, Stu_Name) values(1,'Komal');

1 row created.

SQL> insert into Stu_Table (Stu_Id, Stu_Name) values(2,'Ajay');

1 row created.

SQL> insert into Stu_Table (Stu_Id, Stu_Name) values(3,'Rakesh');

1 row created.

SQL> insert into Stu_Table (Stu_Id, Stu_Name) values(4,'Bhanu');

1 row created.

SQL> insert into Stu_Table (Stu_Id, Stu_Name) values(5,'Santosh');

1 row created.

SQL> select * from Stu_Table;

ST STU_NAME STU_CLASS
-- ---------- ----------
1 Komal
2 Ajay
3 Rakesh
4 Bhanu
5 Santosh

Table Structure is like this

SQL> Describe Stu_Table
Name Null? Type
----------------------------------------- -------- ----------------------------
STU_ID VARCHAR2(2)
STU_NAME VARCHAR2(10)
STU_CLASS VARCHAR2(10)

now when i try to modify this Stu_id column to not null its give me error.

SQL>ALTER TABLE Stu_Table MODIFY Stu_Id int(3)not null;
ALTER TABLE Stu_Table MODIFY Stu_Id int(3)not null
*
ERROR at line 1:
ORA-01735: invalid ALTER TABLE option

and when i try to add new column with not null its also gives me error

SQL> ALTER TABLE Stu_Table add C1_TEMP integer NOT NULL;
ALTER TABLE Stu_Table add C1_TEMP integer NOT NULL
*
ERROR at line 1:
ORA-01758: table must be empty to add mandatory (NOT NULL) column

View 6 Replies View Related

SQL & PL/SQL :: Create A Trigger With Requirement Of Achieving Primary Key Functionality?

Sep 22, 2011

I want to create a trigger with the requirement of achieving Primary key functionality.

I have a "EMP" table. the table already contains a duplicate data on "EMPNO" column. i want to restrict entering duplicate data further into table for that i want to create a trigger.

where can i find different triggering events of DML(like update, delete etc...)and DDL(database and schema level).

View 6 Replies View Related

Application Express :: Tabular Form Delete Row Functionality

Aug 29, 2013

I have a wizard created tabular form, adding a row is easy using addRow() function, is there a way that I can delete the row from it?  Let's say I have added a row and not submitted the form, but now I want to delete just that row from the form, how can I do that?

View 1 Replies View Related

Application Express :: No Page Edit Functionality After Upgrade To 4.2.2?

Jul 12, 2013

Apex has been upgraded from 4.1 to 4.2.2. I don't know if the upgrade was done correct or not by the administrator, but I don't have the page edit link anymore,

and anytime I run a individual page from the Edit Application, I have to Log in. Did something went wrong during the upgrade or is this the behavior of Apex now, which I don't think so.

View 1 Replies View Related

Client Tools :: SQL Developer - Disable Save Password Functionality?

Feb 18, 2011

I want to install SQL Developer on a server but don't want the user to be able to store passwords by checking the "Save Password" box.

View 14 Replies View Related

Application Express :: Creating Functionality For Changing Users Password

Mar 12, 2013

I'm trying to create a functionality on my application that lets the user change their password whenever they want or when the password gets expired.

But to do that, first I need a Branch to the page "Password Change" whenever the login procedure returns "Password Expire", but when the user has an expired password he can't access none of the pages of the application.

My other problem is:

Even if I can get the user to be redirect to the "Password Change" page, I would need a function that validate his current expired password, because in order to alter his own, he would need to inform his current password and the new one he desires. If I was using Apex Authentication that would be very easy I think, but I'm obligate to use Database Account Authentication.

View 4 Replies View Related

Application Express :: Interactive Report Subscription - Missing Search Functionality?

Oct 11, 2012

when receiving the output of a report subscription in Apex 4.1.1, the search Box is missing, only the Text string 'Suche:' is displayed.If i download the report as Email or html, the search box is there and usable.

Maybe i'm wrong, but this was not under Apex 4.0.2.

View 0 Replies View Related

SQL & PL/SQL :: Function In Oracle To Select Not-null Columns At Beginning And Null Columns At End?

Jul 12, 2012

I have 8 columns. Some of them might be null.I want to display all 8 columns in my result. Not null columns will be first and null at the end.Here is a sample data :

Employee table :
Employee_id Emp_fname emp_lname emp_mname dept salary emp_height emp_weight
1 aaa ddd d1 100 6 180
2 bbb ccc 120 169
3 dfe d2 5.9 223

The expected result is :
result1 result2 result3 result4 result5 result6 result7 result8
1 aaa ddd d1 100 6 180
2 bbb ccc 120 169
3 dfe d2 5.9 223

View 8 Replies View Related

PL/SQL :: How To Update Null Data With Previous Not Null Data

Oct 25, 2012

Initially i have inserted the data into table like

Date                   xxx       yyyy
1/1/12 1 1
2/1/12 null null
3/1/12 null null
4/1/12 1 1
5/1/12 1 1
6/1/12 null null

in above example data is null for some date here my requirement is how can i copy before not null data(1/1/12) to *2/1/12, 3/1/12* .

View 3 Replies View Related

Application Express :: Interactive Report Functionality For Classic Report?

Jun 27, 2012

I have to implement IR report search functionality (*when ever we click on column header it will display all the values in that particular column , once we click on particular value , the report will filter based on that particular value * ) in classic report .

View 8 Replies View Related

How To Use Decode And Sum

Nov 16, 2009

Which warehouses have pending orders for products, which are not in stock at the warehouse at the moment? Provide warehouse number, id of the product that is not in stock, number of orders issued for this product and total quantity ordered.

The tables I am using are

Warehouses:
Name Type
----------------------------------------
W_ID NUMBER(38)
CITY VARCHAR2(20)
W_SIZE NUMBER(38)

Inventories:
Name Type
-----------------------------------------
P_ID NUMBER(38)
W_ID NUMBER(38)
QUANTITY NUMBER(38)

Orders:
Name Type
-----------------------------------------
ORD_ID NUMBER(38)
SUPPLIER_ID NUMBER(38)
ISSUING_EMP_ID NUMBER(38)
ORDER_DATE DATE
ORDER_STATUS CHAR(1)

This is my code so far:

select w.w_id, i.p_id,
sum(decode(o.ord_id, ' ', i.p_id, 0)) Orders_issued,
select sum(i.quantity)
from
inventories i
orders o,

[code]...

but I get this error:

select sum(i.quantity)
*
ERROR at line 3:
ORA-00936: missing expression

View 2 Replies View Related

SQL & PL/SQL :: What Does DECODE Do

Sep 7, 2011

Just working with Unix for the first time and trying to understand this decode statement?

cursor l_cursor is select decode(type||'-'||to_char(line,'fm99999'),
'PACKAGE BODY-1','/'||chr(10), null) ||
decode(line,1,'create or replace ', '') ||
decode(type||'-'||to_char(line,'fm99999'),
'JAVA SOURCE-1','and compile ' || type || ' named "' ||
name || '"' || chr(10) || 'AS' || chr(10), '') ||
text text
from user_source
where upper(name) = upper(p_name)
order by type, line;

View 8 Replies View Related







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