Between function and character strings
I am under the impression that the Between operator is inclusive.
select last_name from student where last_name between 'A% and 'L%'
and employer = 'A co.';
The result should include all lastnames that begin with A thru L, if they exist in the student table and work for A co. There are lastnames in the student table, that meet these criteria. The only output I get from the above query, are the names that begin with B and L.
Can anyone tell me what I may be doing wrong?
select last_name from student where substr(last_name, 1, 1) between 'A' and 'L'
and employer = 'A co.';
NLS_SORT=?
Similar Messages
-
VARCHAR2:: How to differnciate between NULL and empty string '' ?
Hello to all,
I'm looking for a possibility to differnciate between NULL and empty string '' in column of type VARCHAR2.
I have an application relying on that there is a difference between NULL and ''.
Is it possible to configure ORACLE in some way ?
Thanx in advance,
Thomastry check if a varchar variable has an empty string
by checking its lengthAnd that would accomplish what? But see for yourself:
DECLARE
v_test VARCHAR2(10);
BEGIN
v_test := '';
DBMS_OUTPUT.put_line(LENGTH(v_test));
v_test := NULL;
DBMS_OUTPUT.put_line(LENGTH(v_test));
END; C. -
What is the difference between function and method
Hey I need help I dont know which is the difference between function and method ?
Does anybody can ask me this question.
Thanksjverd wrote:
The first two answers were also correct.Also the blocked message, quoted here for posterity:
"Tinkerbell" wrote:
Methods are defined by Java whereas functions are not. ~ -
Exact difference between function and procedure
exact difference between function and procedure(real time diff.....not like return value, dml....) and function do some work at the same time that work also do procedure..why function
ranitB wrote:
1. Function is called Inline a query. A return value is must.
But, procedure may/may not contain a return value.Not true.
A function may be called in a query providing it meets certain limitations (no DDL, or transactional statements such as commit/rollback etc.).
A function does not have to be called from a query, it can be called from other PL/SQL code or from other external applications.
Regular functions must return a value, though pipelined functions do not...
SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
2 /
Type created.
SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
2 l_idx PLS_INTEGER;
3 l_list VARCHAR2(32767) := p_list;
4 l_value VARCHAR2(32767);
5 BEGIN
6 LOOP
7 l_idx := INSTR(l_list, p_delim);
8 IF l_idx > 0 THEN
9 PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
10 l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
11 ELSE
12 PIPE ROW(l_list);
13 EXIT;
14 END IF;
15 END LOOP;
16 RETURN;
17 END SPLIT;
18 /
Function created.
SQL> SELECT column_value
2 FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
COLUMN_VALUE
FRED
JIM
BOB
TED
MARK... whilst the definition of the function shows a return type, the return statement inside the function simply returns, without a value. That's because the data is passed back through a special "pipeline", and you can write code to show that the data is available to a query as soon as it's piped, and before the function has completed (reached the return statement) if you like.
A procedure does not return a value (And no an OUT parameter is not a "returned" value, it's a writeable parameter, there's a difference)
2. There are some limitations in functions which is possbl through procedures.
Like - Oracle doesn't support DML in functions called in Select queries (using PRAGMA AUTONOMOUS_TRANSACTION will help).Not strictly true. and SQL query is considered to be DML, so a function could perform a query and then be used inside another query...
SQL> ed
Wrote file afiedt.buf
1 create or replace function f_dname(p_deptno in number) return varchar2 is
2 v_dname varchar2(10);
3 begin
4 select dname into v_dname
5 from dept
6 where deptno = p_deptno;
7 return v_dname;
8* end;
SQL> /
Function created.
SQL> ed
Wrote file afiedt.buf
1* select empno, ename, f_dname(deptno) as dname from emp
SQL> /
EMPNO ENAME DNAME
7369 SMITH RESEARCH
7499 ALLEN SALES
7521 WARD SALES
7566 JONES RESEARCH
7654 MARTIN SALES
7698 BLAKE SALES
7782 CLARK ACCOUNTING
7788 SCOTT RESEARCH
7839 KING ACCOUNTING
7844 TURNER SALES
7876 ADAMS RESEARCH
7900 JAMES SALES
7902 FORD RESEARCH
7934 MILLER ACCOUNTING
14 rows selected.It's been discussed many times on the forum... my favourite here...
{message:id=1668675}
Edited by: BluShadow on 17-Sep-2012 09:22 -
Difference between Function and Stored Procedure
Hi guys, i don't understand the exact difference between a function and a stored procedure. I did lot of google but still. Can somebody explain in simple words. Thanks.
Hi,
Here's an example of a user-defined function:
CREATE OR REPLACE FUNCTION factorial
( in_num IN PLS_INTEGER
RETURN PLS_INTEGER
DETERMINISTIC
IS
BEGIN
IF in_num IS NULL
THEN
RETURN NULL;
ELSIF in_num <= 1
THEN
RETURN 1;
ELSE
RETURN in_num * factorial (in_num - 1);
END IF;
END factorial;
SHOW ERRORSThis function retruns an integer. You can use the function (or, more properly, the integer that it returns) anywhere an integer expression is allowed.
For example
SELECT ROWNUM
, factorial (ROWNUM) AS f
, loc
, SUBSTR ( loc
, 1
, factorial (ROWNUM)
) AS s
FROM scott.dept;Output:
` ROWNUM F LOC S
1 1 NEW YORK N
2 2 DALLAS DA
3 6 CHICAGO CHICAG
4 24 BOSTON BOSTON -
Difference between Function and Automated Activity
Hi All,
After struggling with a few BPA Suite/JDev compatibility issues over the past few days, we've finally got a basic setup up and running (JDev 11.1.1.1 worked - 11.1.1.2 did not).
I'm new to BPA and have 2 fairly basic questions - haven't found conclusive answers to these and hence, raising it on this forum...
1. What is the difference between a "Function" and an "Automated activity" in the BPA Suite? I had expected the latter to translate to a BPEL invoke but what appears to happen is:
- "Function" tranlsates to a BPEL Scope + Invoke.
- "Automated activity" translates to a BPEL Scope + Empty Task.
Based on this, I would not plan to use a "Function" for web service invocations but not sure where I would use the automated activities.
2. Is there a BPMN construct that would translate to a BPEL "Assign"? I understand that an Assign is fairly low-level and would normally be expected to be filled in by the BPEL developer (and not by the Business Analyst specifying the BPMN model) but it would be quite handy to be able to specify this in BPMN in some cases..
Thanks..
TBKol
Edited by: TBKol on Apr 23, 2010 4:58 AMHi All,
After struggling with a few BPA Suite/JDev compatibility issues over the past few days, we've finally got a basic setup up and running (JDev 11.1.1.1 worked - 11.1.1.2 did not).
I'm new to BPA and have 2 fairly basic questions - haven't found conclusive answers to these and hence, raising it on this forum...
1. What is the difference between a "Function" and an "Automated activity" in the BPA Suite? I had expected the latter to translate to a BPEL invoke but what appears to happen is:
- "Function" tranlsates to a BPEL Scope + Invoke.
- "Automated activity" translates to a BPEL Scope + Empty Task.
Based on this, I would not plan to use a "Function" for web service invocations but not sure where I would use the automated activities.
2. Is there a BPMN construct that would translate to a BPEL "Assign"? I understand that an Assign is fairly low-level and would normally be expected to be filled in by the BPEL developer (and not by the Business Analyst specifying the BPMN model) but it would be quite handy to be able to specify this in BPMN in some cases..
Thanks..
TBKol
Edited by: TBKol on Apr 23, 2010 4:58 AM -
Difference between function and procedure
Hi all,
Please send me the difference b/w functions and procedures.
Regards
dskumarA procedure may(1 or many) or may not return a
value,I have yet to see a procedure returning a value. Whilst it can pass out values using OUT and IN OUT parameters, it doesn't RETURN values.
A function always returns one value.A function may also include OUT and IN OUT parameters to pass back values but it's not recommended. -
Replace function and '-' character
Hello,
How can I use '-' character in a REPLACE function?
create or replace procedure zd authid current_user as
begin
execute immediate ' create table select ZDK
Replace(SO_HEADER.ZDNUMBER,'' - '','' '') from so_header';
end zd;
Thanks a lot,Hm. I don't see that you want to replace the minus "-". If you truely ment the underscore "_" then you are right. Sometimes it must be escaped since it has the special meaning of "any single character" (same as the ? wildcard for microsoft users). However this is only true for the LIKE operator. Not for the REPLACE function.
examples (non dynamic)
select SUBSTR(Replace('123\456\789\', '\'),7,7) from dual;
789
select SUBSTR(Replace('123_456_789_', '_'),7,7) from dual;
789The escape keyword in not allowed anywhere inside the replace function.
What was your intended input and output?
Just a recommendation. You don't need to specify the third paramater if you just want to remove the search string.
And your insert statement is not dynamic. If you don't create the table dynamically then you can simply write the insert statement inside pl/sql without the need to make it dynamic. This would make testing and debugging much easier!
Edited by: Sven W. on Jul 27, 2011 7:56 PM -
How to establish the relationship between component and character
Hi Gurus,
I'm using MTO with configurable materials,
I have create class, character, configurable profile,
then i create a sales order using VA01, i enter the FG, and choosed the charaters, but the components do not populated.
Do you know how to make all components can be populated automatically after the characters are chosen.
Regards,
DragskyHi ,
Thank you for your response!
My usage is 1 -production
Relevant to sales is ticked in CS02
There is a material A which is working well, i copied material B form A and copied BOM from A.
so now , i choose Obj.dependencies in BOM item, a message pops up saying:
Used more than once - can only be maintained centrally
Message no. CU032
Diagnosis
You want to change global object dependencies locally for an object. However, this is not possible, as the object dependencies are allocated to other objects as well. For this reason, you can only change the dependencies globally using dependency maintenance functions.
Procedure
Change the object dependencies globally in the dependency maintenance function.
Regards,
Dragsky -
Re: Difference between function and procedure
Hello Oracles Guru’s,
I am learning Oracle and I am beginner. My question may be simple and not worth to ask but I am sorry
Why we call Procedures as Stored Procedure but we call functions only functions.
As per my understanding I think but the objects are stored as objects in the database.
Please clarify.HIJACKED THREAD!
Please don't hijack another user's thread.
If you have a question or issue create a new thread and ask it. -
Differnce between function and procedure....
Hi Experts,
I have query,When will use procedure or function..
means:
in what situation we will use fuction,
and which scenario will use procedure?
Can you please explain....?
Thanks in advance....992368 wrote:
Hi Experts,
I have query,When will use procedure or function..
means:
in what situation we will use fuction,
and which scenario will use procedure?
Can you please explain....?
Thanks in advance....Did you try to search this forum. This question has been asked lot of time. The search feature is not very good here may be use GOOGLE with the SITE tag to search. [url http://www.google.com/#safe=strict&output=search&sclient=psy-ab&q=site:forums.oracle.com+function+vs+procedure&oq=site:forums.oracle.com+function+vs+procedure&gs_l=hp.3...6856.24993.0.25236.54.43.6.0.0.0.428.9494.0j10j21j6j1.38.0...0.0...1c.1.15.psy-ab.eIfpP4zL0fM&pbx=1&bav=on.2,or.r_qf.&bvm=bv.47244034,d.cGE&fp=2bbc6037bd7feb17&biw=1024&bih=597]Something like this -
Searching strings in procedures, function and packages (OWB)
Hi all,
I'm working on an OMB script to look for a string in procedures, function and packages in OWB. So far, I found how to do it for functions and procedures:
string match -nocase \*text_to_find* [OMBRETRIEVE FUNCTION 'my_function' GET PROPERTIES(IMPLEMENTATION)]
string match -nocase \*text_to_find* [OMBRETRIEVE PROCEDURE 'my_procedure' GET PROPERTIES(IMPLEMENTATION)]
I have tried something similar for packages but it didn't work. Does someone know how to do this search in packages? Any help will be appreciated.
Regards,
MauricioOf course, if you are looking for a match in any source - including procedures and packages not imported into OWB, then OMB+ isn't going to be a ton of help as it won't be aware of those other packages.
In that case, you can always find those dependencies by doing a standard select owner, name, type, text from all_source where text like '%YOUR_SEARCH_CRITERIA%' query.
and you can embed that in your OMB+ using the Java/SQL library: How to run SQL from OMB+
Cheers,
Mike -
REPALCE() function issue. String getting truncated.
Hi,
I am using ORACLE DATABASE 11g. I am facing a very strange problem. I have a string in an variable when i print that sting i can see that the string is correct but after applying a replace function on to it when i print the string the string is incomplete.
Details are as follows :- In the code i am getting some DDL statement (alter table ) , this is the difference between the 2 compared tables. Then I want to place ';' at the last of each line and keyword 'BEGIN' at start and 'END;' at the last. I tried to do this with replace() function but the output string is shot than needed. Please follow the code :-
dbms_output.put_line('V_TAB_DIFF_ALTER:=' || V_TAB_DIFF_ALTER); -- Print the original string. Variable datatype used varchar2(32767)/CLOB
dbms_output.put_line('SOURCE Size := '||Length(V_TAB_DIFF_ALTER)); -- Size of the original string.
V_TAB_DIFF_ALTER_REP :=V_TAB_DIFF_ALTER; -- Placed the sting in new variable.
V_TAB_DIFF_ALTER_REP := 'BEGIN '||replace(V_TAB_DIFF_ALTER_REP,CHR(10),';') || ' END;'; -- Used the replace function and concatenate string.
-- EXECUTE IMMEDIATE V_TAB_DIFF_ALTER_REP;
dbms_output.put_line('After replace := '||V_TAB_DIFF_ALTER_REP); -- Now again printing the sting but this time its not proper.The output is as follows :-
V_TAB_DIFF_ALTER:=ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("BENEFICIARY_ACCOUNT_ID" VARCHAR2(32))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("HAS_OFFSET_ACCOUNT" CHAR(1) DEFAULT 'N')
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("MARKET_ENTITY" VARCHAR2(40))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_PREVIOUS_STATUS" VARCHAR2(50))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVIOUS_STATUS" VARCHAR2(50))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_COUNTER" NUMBER)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_DATE" DATE)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("STMT_CYCLE_DAY" NUMBER)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVENT_EXCESS_FLAG" CHAR(1))
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_START_DATE" DATE)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_EXPIRY_DATE" DATE)
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_SANCTIONED_AMT" NUMBER)
SOURCE Size := 1830 -- Length of original string.
After replace := BEGIN ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("BENEFICIARY_ACCOUNT_ID" VARCHAR2(32));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("HAS_OFFSET_ACCOUNT" CHAR(1) DEFAULT 'N');
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("MARKET_ENTITY" VARCHAR2(40));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_PREVIOUS_STATUS" VARCHAR2(50));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVIOUS_STATUS" VARCHAR2(50));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_COUNTER" NUMBER);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("FUTURE_AS_OF_DATE" DATE);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("STMT_CYCLE_DAY" NUMBER);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("PREVENT_EXCESS_FLAG" CHAR(1));
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_START_DATE" DATE);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_EXPIRY_DATE" DATE);
ALTER TABLE "NGPR2ST"."FLX_DD_ACCOUNTS_B" ADD ("TEMP_EXCESS_SANCTIONE ------ Here the remaining string is missing.
NEW Var. Length :- 1862 -- Length of the new string but still the printed string is not the perfect one. It only prints 1830 characters, rest are not printed.
{code}
Here you can see that the sting in after replace in actually short and will give error when trying to execute. As you can also see that length of new string is more i.e. 1862 but its reading and writing only 1830 characters => which is the actual size of original string.
Variable datatypes used varchar2(32767) and CLOB. Faced issues in both the cases.
Its very obvious that when i am trying to replace a few things then I can add a bit more to it. Why is it only reading or writing only the 1830 character string not the whole 1862 string ??? How can i get the size as 1862 but not the whole string ??
Let me know any solution on this ...
Thanks in advance.
Edited by: VIRU on Nov 17, 2011 10:24 PMThanks William for your reply.
I have tried with increasing the buffer size by
exec dnms_output.enable(40000000);but still no improvements.
I was able to successful print long strings than this one but when it comes to format it with replace i am facing this scenario.
Let me know if you have any idea. -
Difference between reports and script
Gayathri
Hi,
Reports:
Used to display the existing data from the database tables for the analysis purpose
SCRIPTS:
They are the Outgoing documents from an organisation to the outside Partners like vendors and Customers.
Report is basically a program which extracts the data from the database tables based on some inputs and gives the output as a list.
Report are classified as Classical Reports, Interactive Reports and ALV Report.
Classical Report is a normal report which just displays the output.User cannot interact with that report.
Interactive Report is nothing but, a user can interacte with the report.After a basic list is displayed, user can click on some field on the list which generates a secondary list giving the necessary information relevant to that field.
ALV Report is to provide users with a consistent, user friendly and functional method of manipulating the data, which appears on report lists. ALV provides more advantages than the normal report.
SAP scripts is a word processing tool of SAP which has the following components: Standard text. It is like a standard normal documents. Layout sets. - Layout set consists of the following components: Windows and pages, Paragraph formats, Character formats. Creating forms in the R/3 system. Every layout set consists of Header, paragraph, and character string. ABAP/4 program.
Regards,
Omkar. -
Difference in Null and Empty String
Hi,
I have been wondering about the difference between Null and Empty String in Java. So I wrote a small program like this:
public class CompareEmptyAndNullString {
public static void main(String args[]) {
String sNull = null;
String sEmpty = "";
try {
if (sNull.equalsIgnoreCase(sEmpty)) {
System.out.println("Null and Empty Strings are Equal");
} else {
System.out.println("Null and Empty Strings are Equal");
} catch (Exception e) {
e.printStackTrace();
This program throws Exception: java.lang.NullPointerException
at practice.programs.CompareEmptyAndNullString.main(CompareEmptyAndNullString.java:10)
Now if I change the IF Clause to if (sEmpty.equalsIgnoreCase(sNull)) then the Program outputs this: Null and Empty Strings are Equal
Can anyone explain why this would happen ?
Thanks in Advance !!JavaProwler wrote:
Saish,
Whether you do any of the following code, the JUnit Test always passes: I mean he NOT Sign doesnt make a difference ...
assert (! "".equals(null));
assert ("".equals(null));
You probably have assertions turned off. Note the the assert keyword has nothing to do with JUnit tests.
I think that older versions of JUnit, before assert was a language keyword (which started in 1.4 or 1.5), had a method called assert. Thus, if you have old-style JUnit tests, they might still compile, but the behavior is completely different from what it was in JUnit, and has nothing to do with JUnit at all.
If you turn assertions on (-ea flag in the JVM command line, I think), the second one will throw AssertionError.
Maybe you are looking for
-
How to export an array to an excel-sheet
Hallo, does somebody knows how i can write an String[][]-Array in an simple Excel-Table, or knows someone a source where i can find information about the xls-fileformat?
-
Hi Folks, I have done every setting in Swu3 and initally deadline for work flows use to trigger, But however for a strange reason they stopped Trigerring deadlines. please help me in trigerring the deadline since there are some work items need to go
-
Hi All, I want to fill setup tables witout going for down time I dont mind even if some of my records miss. I will only need to reconcile data from my first delta and do reporting from first delta. What is the solution for this Regds Raj
-
How can I stop 'Finder' from automatically opening subfolders and displaying the contents of the subfolders?
-
BB Link not linking to Win Media Player or iTunes
Out of the blue, my BB Link will not show my music library in iTunes or Windows Media Player. I'm using version 1.0.0.76 and have even reinstalled BB Link. I tried with WMP and iTunes closed and open. It worked a few days ago now I'm having no luck -