`
javasogo
  • 浏览: 1817013 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Oracle PL SQL :TIPS

 
阅读更多

//z 11/9/2011 2:49 PM @is2120@csdn
2. ORACLE 中查看和修改存储过程
2.1
select text from user_source where name='PROCEDURE' order by line;
2.2
select text from all_source where owner='USERNAME' and type='PROCEDURE' and name='PROCEDURENAME';
2.3
set heading off
set echo off
set feedback off
set pages off
set long 90000
SEELCT DBMS_METADATA.GET_DDL( 'PROCEDURE ', 'YOURPROCEDURENAME ') FROM USER_OBJECTS WHERE OJBECT_TYPE= 'PROCEDURE ' AND OBJECT_NAME= 'YOURPROCEDURENAME ';



1. 空字符串和null value的区别 zz
在面向sql server和oracle的代码中因为加了Column<>''导致返回的结果不一致,经查询才知道oracle对空字符串("")做了特殊处理;应该是常识,
记录一下。


Oracle/PLSQL:Difference between an empty string and a null value


Question: What is the differencebetween an "empty" value and a "null" value? When Iselect those fields that are "empty" versus "null", I gettwo different result sets.

Answer: An empty string is treatedas a null value in Oracle. Let's demonstrate.

We've created a table calledsuppliers with the following table definition:

create table suppliers

( supplier_id

number,

supplier_name

varchar2(100));

Next, we'll insert two records intothis table.

insert into suppliers (supplier_id,supplier_name )
values ( 10565, null );

insert into suppliers (supplier_id,supplier_name )
values ( 10567, '' );

The first statement inserts a recordwith a supplier_name that is null, while the second statement inserts arecord with an empty string as asupplier_name.

Now, let's retrieve all rows with asupplier_name that is an empty string value as follows:

select * from suppliers
where supplier_name = '';

When you run this statement, you'dexpect to retrieve the row that you inserted above. But instead, this statementwill not retrieve any records at all.

Now, try retrieving all supplier_idsthat contain a null value:

select * from suppliers
where supplier_name is null;

When you run this statement, youwill retrieve both rows. This is because Oracle has now changed its rules sothat empty strings behave as null values.

It is also important to note thatthe null value is unique in that you can not use the usual operands (=,<, >, etc) on a null value. Instead, you must use theIS NULL and IS NOT NULLconditions.

Acknowledgements: We'd like to thank Charles Rothfor contributing to this solution!

c# sql server oracle 空字符串 String.Empty "" '' <> null
分享到:
评论

相关推荐

    Oracle Database 10g PL-SQL Programming

    ### Oracle Database 10g PL/SQL Programming #### 1. Introduction to PL/SQL PL/SQL (Procedural Language for SQL) is a procedural extension to SQL that provides a powerful way to manipulate data within...

    Top 200 Oracle PLSQL Tips for Tuning

    标题“Top 200 Oracle PL/SQL Tips for Tuning”以及描述同样提到的“Top 200 Oracle PL/SQL Tips for Tuning”,明确指出该文档旨在提供一系列针对Oracle PL/SQL性能调优的实用技巧。这表明文档的核心内容将围绕...

    Oracle-sql-Performance-Tuning-30Tips.rar_oracle_tom kyte

    "Oracle SQL Performance Tuning 39Tips" 提供了由Oracle专家Tom Kyte精心总结的30个SQL优化技巧,这些技巧旨在帮助用户提升数据库查询速度,减少资源消耗,提高系统整体性能。 1. **索引优化**:Tom Kyte强调了...

    最完整的Toad For Oracle使用手册

    - **PL/SQL Debugger**:指导用户如何使用PL/SQL调试器查找并修复代码中的问题。 - **SQL*Loader**:提供了关于SQL*Loader的教程,帮助用户加载数据到Oracle数据库。 - **Team Coding**:探讨了如何通过团队编码提高...

    oracle的一些tips技巧

    本文将探讨Oracle的一些实用技巧,特别是关于获取当前会话信息的方法,这对于理解和解决SQL注入问题以及进行性能调优非常有帮助。 `SYS_CONTEXT`函数是Oracle提供的一种用于获取当前会话属性的关键工具。它允许...

    Oracle APEX Cookbook, 2nd Edition

    A little knowledge of PL SQL HTML and JavaScript is assumed Book Details Paperback: 444 pages Publisher: Packt Publishing; 2nd Edition October 2013 Language: English ISBN 10: 1782179674 ISBN 13: ...

    201811050370-徐贝宁-学习和练习代码1

    运行PL/SQL代码通常需要特定的工具,如SQL*Plus、Oracle SQL Developer等。 ```markdown ## How to run PL/SQL code ``` 总结以上内容,我们不仅了解了如何在Oracle中创建表及其主键约束,还学习了如何使用Python...

    E-Business.Suite.R12.Core.Development.and.Extension.Cookbook

    书中可能会讲解如何编写和优化PL/SQL代码,以及如何利用Oracle Forms和Reports进行前端交互。 3. **自定义开发**:阐述如何通过Personalization、Flexfields、Workflows和Packages等工具对EBS进行定制,以适应企业...

    Oracle - Tips and Techniques for Statistics Gathering (Arup Nanda)-计算机科学

    Tips and Techniques for Statistics GatheringArup Nanda ...PL/SQL procedure successfully completed.SQL&gt; print retStats Collection Tips and Techniques 3rep.sqlLowdown on Stats • Optimizer Statistics on

    JDBC Developers Guide Reference.rar

    and register PL/SQL index-by tables in JDBC. Chapter 12, "Result Set Enhancements" This chapter discusses JDBC 2.0 result set enhancements such as scrollable result sets and updatable result sets, ...

    Kindle Computer Science other.rar

    Database\Apress Expert PL SQL Practices for Oracle Developers and DBAs.mobi Database\Apress Oracle PLSQL Recipes - A Problem-Solution Approach.mobi Database\Apress Pro Oracle Database 11g ...

Global site tag (gtag.js) - Google Analytics