Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
How to INSERT row when only doesn't exist ?
hello albert, as mr. sandeeptiwari mentioned on your question as comment you can use merge statement and here i will share with you sample example for merge and not exists with regular insert statement first we need to create dummy table to test our code on it : CREATE TABLE testtab ( id NUMBER PRIMRead more
hello albert,
as mr. sandeeptiwari mentioned on your question as comment you can use merge statement and here i will share with you sample example for merge and not exists with regular insert statement
first we need to create dummy table to test our code on it :
now we will using not exists clause with regular insert statement but with select like this :
now the result would be :
1 row created.
then trying to execute same statement again and check the result :
0 rows created.
that because the row is already exists before
now we will trying to do the same but in this time we will using merge statement :
now the result would be :
1 row merged.
then trying to execute same statement again and check the result :
0 row merged.
hope this help 🙂
See lessis there oracle function to remove spaces in the string ?
hi albert, try this : select replace('Oracle Forms 10G', chr(32), '') from dual; hope this help.
hi albert,
try this :
hope this help.
See lessFRM-47001: Cannot create parameter list myparam : list with this name already exists
just you need every time to check if the parameter list exists.... If so , delete it before you try to create it. DECLARE pl_id ParamList; BEGIN pl_id := Get_Parameter_List('tempdata'); IF NOT Id_Null(pl_id) THEN Destroy_Parameter_List(pl_id); END IF; END; hope this helpfull :)
just you need every time to check if the parameter list exists…. If so , delete it before you try to create it.
hope this helpfull 🙂
See lessjava.sql.SQLException: Invalid column type Error when extending a VO
What you need to change is the Binding Style from Oracle Named to Oracle Positional in the View Object declaration. The framework is adding a where clause to the query using bind variables that are typed :n, this is why you need to set Oracle Positional.
What you need to change is the Binding Style from Oracle Named to Oracle Positional in the View Object declaration. The framework is adding a where clause to the query using bind variables that are typed :n, this is why you need to set Oracle Positional.
See lesshow to create dynamic tables ,columns, and datatype for each column in oracle ?
hello @Tiwari Sandeep what i meant is i want create table at run time like create table tablename (col1 varchar2(50), col2 number); actually we can do this by dynamic SQL but it's unfortunately not recommended by oracle because this will open a loophole for hackers by (SQL INJECTION) if you have anyRead more
hello @Tiwari Sandeep what i meant is i want create table at run time like
actually we can do this by dynamic SQL but it’s unfortunately not recommended by oracle because this will open a loophole for hackers by (SQL INJECTION) if you have any idea to avoid this will be very appreciated
thank you for your reply.
See lessHow to Raise User-Defined Exception and display Custom SQLERRM ?
you can do this by using : RAISE_APPLICATION_ERROR function and here simple example for you : DECLARE custom_ex EXCEPTION; PRAGMA EXCEPTION_INIT (custom_ex, -20001); BEGIN raise_application_error (-20001, 'Your custom error message here'); EXCEPTION WHEN custom_ex THEN dbms_output.put_line (sqlerrm)Read more
you can do this by using : RAISE_APPLICATION_ERROR function and here simple example for you :
the output would be : ” ORA-20001: Your custom error message here ” .
See lesshope this help 🙂
How to know number of rows updated by UPDATE statement ?
SQL%ROWCOUNT : return the number of rows fetched/processed by the last DML executed. If the DML fails after fetching 1 row, due to any reason, SQL%ROWCOUNT will return only 1, the number of rows fetched/processed so far basically you can use : BEGIN UPDATE xx_test_tab SET test_col = 777777 WHRead more
SQL%ROWCOUNT : return the number of rows fetched/processed by the last DML executed. If the DML fails after fetching 1 row, due to any reason, SQL%ROWCOUNT will return only 1, the number of rows fetched/processed so far
basically you can use :
hope this help 🙂
See lessCan i use select statement inside if statement ? (if (select) > 0 then) ?
hello Beter, you can't use SQL Statement directly in a PL/SQL expression instead you can use variable to store your count then use your variable into PL/SQL expression like this : DECLARE v_count NUMBER;BEGIN SELECT count (*) INTO v_count FROM dual; IF v_count >= 1 THEN dbms_output.put_liRead more
hello Beter,
you can’t use SQL Statement directly in a PL/SQL expression instead you can use variable to store your count then use your variable into PL/SQL expression like this :
or as you mentioned if you want to use it inside delete statement like this :
hope this helpful 🙂
See lessHow to Insert data include symbol '&' into a table ?
it's very simple just using this : set define off insert into table values ('& yourvalues'); and then press 'F5' to execute the above commands. also from sqlplus you can use this : set define off
it’s very simple just using this :
and then press ‘F5’ to execute the above commands.
See lessalso from sqlplus you can use this :
set define off
How can i convert CLOBS TO VARCHAR2 column ?
hello Beter, you can use dbms_lob.substr( clob_column, for_how_many_bytes, from_which_byte ); and here basic two example : first by using SQL but note the max length is 4000 characters: select dbms_lob.substr( clob_col, 4000, 1 ) from Tablename; second by using PL/SQL max length is 32000 charactersRead more
hello Beter,
you can use
and here basic two example :
first by using SQL but note the max length is 4000 characters:
second by using PL/SQL max length is 32000 characters :
hope this may help.
See lessyou can refer to DBMS_LOB from oracle