How to get rowcount on dynamic sql?
Gurus, experts, and just plain people who are smarter than me. I've googled and googled and I while there are examples of how to do this, there is some complication that doesn't apply to me!
I have a PLSQL function that depends upon knowing the number of rows returned in order to figure out what to set a variable to.
E.g.:
v_sql := 'select element_id from '||v_lsidt||'_base where element_id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql
IF SQL%ROWCOUNT > 0 THEN
ELSE
END IF
Unfortunately, it seems like the rowcount is always coming back as so the code doesn't pass through the IF block. Can someone explain to me what I'm doing wrong?
Thank you.
PS - I realize this may be a common question so I apologize in advance if the answer was in plain sight and I failed to recognize it lol.
ErrolDC wrote:
Gurus, experts, and just plain people who are smarter than me. I've googled and googled and I while there are examples of how to do this, there is some complication that doesn't apply to me!
I have a PLSQL function that depends upon knowing the number of rows returned in order to figure out what to set a variable to.
E.g.:
v_sql := 'select element_id from '||v_lsidt||'_base where element_id = '||chr(39)||v_osid||chr(39);
EXECUTE IMMEDIATE v_sql
IF SQL%ROWCOUNT > 0 THEN
ELSE
END IF
Unfortunately, it seems like the rowcount is always coming back as so the code doesn't pass through the IF block. Can someone explain to me what I'm doing wrong?
Thank you.
PS - I realize this may be a common question so I apologize in advance if the answer was in plain sight and I failed to recognize it lol.when all else fails Read The Fine Manual
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/returninginto_clause.htm#CJAGFGDE
Similar Messages
-
How to get login ID in SQL?
Hi,
How to get login Id in sql?
such as "select * from table1 where userlogined=:{$loginid$}"?
Best Regards,
Jason GaoHi,
You would need to create a parameter in your report called userloginid select the paramter data type to match that of the datatype this value is stored as in the table.
then the correct syntax would be select * from table1 where userloginid=:userloginid
Hope this helps,
Domnic -
How to get this output using sql query?
Hi,
How to get this output using sql query?
Sno Name Age ADD Result
1 Anil 23 delhi Pass
2 Shruti 25 bangalor Pass
3 Arun 21 delhi fail
4 Sonu 23 pune Pass
5 Roji 26 hydrabad fail
6 Anil 28 delhi pass
Output
Sno Name Age ADD Result
1 Anil 23 delhi pass
28 delhi passHi Vamshi,
Your query is not pretty clear.
write the select query using Name = 'ANIL' in where condition and display the ouput using Control-break statements.
Regards,
Kannan -
How can get a database like ****.SQL file for test in sqlplus in oracle8i
How can get a database like ****.SQL file for test in sqlplus in oracle8i,I am a beginner,thanks
I'll give it a guess as to what it is you want but I'm afraid you'll have to give some more information to go on. I appreciate it's difficult for people who are beginners or who don't have English as their first language.
Are you trying to run a SQL file? From SQL*plus you can do either of these:
SQL> start my_file
or
SQL> @my_file
N.B.: if th efile has a .sql extension you don't need to include it, but you do for any other file extension e.g.
SQL> @myfile.run
Here is the page Vijay referred to:
Re: Physical storage Checks & adding disk on server. I hope you find it useful.
You will more helpful links (including links to the Oracle on-line manuals at this page:
Re: How to attach a java bean in forms6i
good luck, APC -
How to get rowcount of VO on .vm file?
how to get rowcount of VO on .vm file?
The JSF expresion is:
#{bindings.<iteratorName>.estimatedRowCount}
In JHeadstart, iterators are named after the group suffixed with "Iterator", so in the .vm you can use the folloqwing:
#{bindings.${JHS.current.group.name}Iterator.estimatedRowCount}
Steven Davelaar,
JHeadstart Team. -
How to get Unapplied Amount with SQL or API in AR/ORACLE RECEIVABLES
Hi ,
how to get Unapplied Amount with SQL or API in AR/ORACLE RECEIVABLES.
who can help me ? Thank you very much !i get it from private API.
SELECT SUM(decode(ra.status, 'UNAPP', nvl(ra.amount_applied, 0), 0)) unapplied_amount
FROM ar_receivable_applications ra
WHERE ra.cash_receipt_id = 1820
AND ra.status IN ('UNAPP', 'ACTIVITY') -
How to obtain IR report dynamic SQL in Apex 4.0
Hello,
I have 2 regions on the same page
Interactive Report –
Chart (Flash Chart) – This is a sub region of the above
Now the requirement is when user applies a filter to the interactive report I would like to apply the same filter criteria to the flash chart so that data representation in flash chart matches with the IR report content. I am fairly new to the Apex, apologies if used any apex terminology in correctly
Appreciate if you can point me in the right direction
Thank you
-RajHello , I did some research how to achieve this , one way is to get the IR report dynamic sql using APEX_IR.GET_REPORT package and apply the same sql for the chart so that the chart representation will match with the IR report data, But the challenge is as i am using the APEX 4.0.0.00.46 version, the APEX_IR package is not available in that version , Any other way we can achieve this in Apex 4.0??
Thanks
-raj -
How to get Arabic dates in SQL*Plus?
I want to do a very simple thing.
I want to type in Arabic and Display dates in Arabic.
Instead i get ????? ??????? ????? ??????? ? ? ???????, ????? for this?
Why is this?
I then changed my Windows XP "Regional and Language Options" all to Arabic. Now, I get AR (Arabic) in my language selection bar at the bottom of the Desktop. When I choose AR I can type Arabic in Notepad. ُ
Even HERE I can type in Arabic: فغحث غخعق ةثسسشلث اثقث
But in Sql*PLus I get ????? ??????? ????? ??????? ? ? ???????, ?????
If I choose AR in SQL Plus and type in Arabic I get garbage characters?
How to get Arabic in Sql*Plus?
SQL> SHOW USER
USER is "ARABDTEST"
SQL> SELECT * FROM v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
PL/SQL Release 11.1.0.6.0 - Production
CORE 11.1.0.6.0 Production
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production
SQL> SELECT * FROM nls_session_parameters;
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
17 rows selected.
SQL> ALTER SESSION set NLS_DATE_LANGUAGE = 'ARABIC';
Session altered.
SQL> SELECT TO_CHAR(SYSDATE, 'RRRR/MM/DD YEAR MONTH DAY MON DY AM PM DL') FROM dual;
TO_CHAR(SYSDATE,'RRRR/MM/DDYEARMONTHDAYMONDYAMPMDL')
2013/04/08 TWENTY THIRTEEN ????? ??????? ????? ??????? ? ? ???????, ????? 08, 2013
SQL> ALTER SESSION set NLS_DATE_LANGUAGE = 'AMERICAN';
Session altered.
SQL> SELECT TO_CHAR(SYSDATE, 'RRRR/MM/DD YEAR MONTH DAY MON DY AM PM DL') FROM dual;
TO_CHAR(SYSDATE,'RRRR/MM/DDYEARMONTHDAYMONDYAMPMDL')
2013/04/08 TWENTY THIRTEEN APRIL MONDAY APR MON PM PM Monday, April 08, 2013
SQL> SELECT * FROM nls_database_parameters;
PARAMETER VALUE
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET WE8MSWIN1252
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 11.1.0.6.0
20 rows selected.I am not sure SQL*Plus in character mode can display Arabic characters on Windows. OTN NLS_LANG FAQ http://www.oracle.com/technetwork/products/globalization/nls-lang-099431.html#_Toc105389288 says:
>
if you are testing with "special" characters please DO use the GUI and not the "DOS box" sqlplus.exe !
>
SQL*Plus GUI is not available with 11G: you should use SQL Developer. -
How to get Worksheet Description from SQL
Hi,
Can any one help me out. How to get Workbook and Worksheet Description from SQL. I have entered these descriptions from Discoverer Plus.
Thanks in advance.check this !!!! at least it a starting point
Thread: Where in the EUL schema can I find metadata on worksheets
I followed this steps:
Use the following steps to get the Trigger Working:
1. Login as EUL owner EUL10
Create a test table
CREATE TABLE eul10.TRIG_TAB
ACC_DATE DATE,
sso_name varchar2(100)
2. Create a function under the eul schema owner: eul_trigger$post_login
Do not pass any argument to the function.
Return a number from function.
CREATE OR REPLACE FUNCTION EUL10.EUL_TRIGGER$POST_LOGIN
RETURN NUMBER AS
BEGIN
insert into EUL10.TRIG_TAB(acc_date) values(sysdate);
commit;
RETURN 0;
END;
3. Login with Discoverer Administrator to EUL=EUL10.
4. Check the Menu > Tools > Default EUL.
Make sure this is set to EUL10
If not then change the EUL10 and restart Discoverer Administrator.
5. Now Register the trigger in Discoverer Administrator
Menu >Tools > Register PL/SQL Function ...
6. Click import
7. Select the trigger EUL10.eul_trigger$post_login
|8. Make sure the display name is eul_trigger$post_login (MUST BE lowercase or it will not work)
Function name must be in uppercase: EUL_TRIGGER$POST_LOGIN
9. Make sure the the return type is number and that no arguments get passed.
10. Validate the Function by clicking on the Validate button.
11. Click ok
12. Connect with Discoverer desktop as EUL owner.
13. We see entries in the table trig_tab with the current date.
...... metalink note : 372067.1 Subject: How To Get the EUL_TRIGGER$POST_LOGIN Trigger to Work -
How to get rowcount in a query which is built on Infocube
Hi,
I would like to show rowcount for a report which is built on Infocube.
If i have a query on DSO, i would get Rowcount in the query designer but how can we get this same Rowcount if i create a query on Infocube.
Thanks in advanceIf you want to just know the number of records without the need to offer this to users in a query, then use transaction LISTCUBE.
Make you "Field Selection for Output" via the button to tick the characteristics by which you want to count the number of entries and tick the box "Output number of hits" in the settings section of the selection screen, clear the "Max number of hits" field to make sure you get all rows in your result. On the result list the field counter shows the number of entries.
Best,
Ralf -
How to get text of Last SQL Query
Sorry if this has been covered, but the search page keeps erring on me.
I am trying to figure out how to get the text of the last SQL statement executed (succesfully or unsuccesfully) by my current login.
What it is, is i want in the exception handler of my procedure to be able to dump the text of the Query which was last run into the log file.
Any help with this will be greatly appreciated!
Thanks in advance,
Aaron.
[email protected]Well, ive been trying V$SQLTEXT in conjunction with V$SESSION and USERENV('SESSIONID'). This gets me my SQL statements, but the SQL_HASH_VALUE and PREV_HASH_VALUE, which are supposed to be the current and previous statements respectively always are the same and always point to the current statement..... is there some sort of flag you have to set to get PREV_HASH_VALUE (and PREV_SQL_ADDR) to actually point to the **PREVIOUS** statement??
-
How to get the last executed SQL Statemnt of my session
Hello,
I am trying to log my SQL-Statements that I use in a PL/SQL Procedure or Package iinto a text file.
How can I log my SQL-Statement without repeating the Statement?
Here is an example:
INSERT INTO people (id, name)
SELECT people.nextval, name from people_to_load;
log_pkg.log(getLastStatement());
I don't want to code the following:
INSERT INTO people (id, name)
SELECT people.nextval, name from people_to_load;
log_pkg.log('INSERT INTO people (id, name) SELECT people.nextval, name from people_to_load;'),
Thank's for any feedback.
OliverHi,
You can get from the V$sql SQL (statements that are in memory, parsed, and ready for execution).
with respective to your Session. Else if you want to seee you can get from the Redo Logs with the utlility Lop Minner..
Sorry I misunderstood your question.. !!
Go for Dymanic SQL where you can Build a Query.. and Hold that Query in one String and Pass it on as the parameter to the Package or Procedure what ever you are using for logging purpose...
You can go for Auditiing in stead of Custom Logging.
- Pavan Kumar N
Edited by: Pavan Kumar on Sep 23, 2008 2:13 PM
Edited by: Pavan Kumar on Sep 23, 2008 2:15 PM -
Getting error during Dynamic sql
Hi,
I'm facing issue with dynamic sql.My aim in the following code is to get count from the table, if pattern "xyz" exits for past 5 mins.
I'm getting the following error
ORA-01006: bind variable does not exist
/* *Sample code is/
declare
lv varchar2(10):='xyz';
li_count number :=0;
sql_var varchar2(2000):=null;
begin
sql_var := 'SELECT COUNT(1) FROM wms_trace WHERE LOWER(MSG_TEXT) LIKE LOWER(''%' || ':1' ||'%'') AND create_dt> sysdate - 0.083333/24';
DBMS_OUTPUT.PUT_LINE(sql_var);
EXECUTE IMMEDIATE sql_var into li_count using lv;
DBMS_OUTPUT.PUT_LINE(li_count);
end;
I went for dynamic sql since i could not put my vairable in side , as follow
like lower ('%lv%'). If i put instead of search for "xyz" it will search for variable name itself as "lv"
Thanks in advance for your help
KannanYou don't need to use dynamic SQL in this case. Try the following (untested):
DECLARE
lv varchar2(10):='xyz';
li_count number :=0;
BEGIN
SELECT COUNT(1) INTO li_count
FROM wms_trace
WHERE LOWER(MSG_TEXT) LIKE '%' || LOWER(lv) || '%'
AND create_dt> sysdate - 0.083333/24
END; -
How to get Host name and SQL Instance Name by T-SQL
I am using SQL 2000, 2005 and 2008. I have few multi instances SQL servers. I would like to gather following information:
Host Name
SQL Instance Name
SQL Version
Server1
Server1
SQL 2000
Server1
Server1\ABC
SQL 2005
Server1
Server1\XYZ
SQL 2008
Server2
Server2
SQL 2008
Is there any way I can get it by T-SQL? Any help would be appreciated.
Thanks
SaumenSELECT
SERVERPROPERTY('MachineName') AS [ServerName],
SERVERPROPERTY('ServerName') AS [ServerInstanceName],
SERVERPROPERTY('InstanceName') AS [Instance],
SERVERPROPERTY('Edition') AS [Edition],
SERVERPROPERTY('ProductVersion') AS [ProductVersion],
Left(@@Version, Charindex('-', @@version) - 2) As VersionName
|
Blog: MSBICOE.com |
MCITP - BI, SQL Developer & DBA
Hate to mislead others, if I'm wrong slap me. Thanks! -
How BW get data from MS SQL server DB?
I got infomation about this from help.com, http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm.
this web told me, when BW application server must be Win NT.BW can get data from MS SQL server DB.
but our BW application server was AIX.
Did you know other solution to this?Hi,
you need to use the DBConnect or in BI7.0 the UDConnect features.
regards
Siggi
See also: http://help.sap.com/saphelp_nw70/helpdata/EN/a1/89786c3df35c4ea930a994e884bb4c/frameset.htm
or
http://help.sap.com/saphelp_nw70/helpdata/EN/44/bcdce1dcaf56a3e10000000a1553f6/frameset.htm
Edited by: Siegfried Szameitat on Aug 13, 2008 9:16 AM
Maybe you are looking for
-
How can I move pictures from 1 iPhone to another
Trying to transfer pictures from my wifes old 3gs to a 4. nothing seems to work any suggestions
-
Aperture with iPhoto questions
Hi gang, The new integration of iPhoto and Aperture 1.5 sounds very appealing. I have a couple of questions regarding functionality. Let's assume that I have Aperture set to use my iPhoto library in referenced file mode. 1) Will Aperture keep the two
-
How to add group managers who will be able to add members?
I go to beehiveonline.oracle.com, select "Create group or add members", click through to page with Group Name, Add new members, View members, etc. I click on name of group to arrive to "Group Edit" page, where I add group manager emails. I enter new
-
Whether 512MB RAM enough for NW2004s ABAP Sneak Preview?
Hi Friends, I am planning to install NW2004s ABAP Edition in my PC. I have only 512MB RAM at the moment but the min requirement is 1GB RAM for NW2004s ABAP EDITION.My question is:Is it possible to install with 512MB?..Will it support? or Will it crea
-
I have Adobe Professional. In IE 7, I used to be able to save items as pdf. I have a grayed out pdf icon and the pdf box is checked in toolbar. How do I get it back to operable.