V$parameter in pl/sql
wht cant i access table v$parameter in pl/sql.
I can query the table from sql plus.
When I try using a cursor having this table in the query,
the procedure fails to compile
I tried execute immediate, it gives run time error saying
table or view does not exist.
is there any way out
Thanks
Ashwin N.
This is the procedure and error
1 CREATE OR REPLACE PROCEDURE some_tp as
2 v_db VARCHAR2(100) :=NULL;
3 my_sql VARCHAR2(300);
4 -- v_param VARCHAR2(300);
5 BEGIN
6 my_sql := 'SELECT value INTO :v_db FROM v$parameter WHERE name = ''db_name'' ';
7 EXECUTE IMMEDIATE my_sql INTO v_db ;
8 DBMS_OUTPUT.PUT_LINE('DB NAME IS ' ||v_db);
9* END ;
12:02:26 10 /
Procedure created.
12:02:26 SQL> exec some_tp
BEGIN some_tp; END;
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "CALCTEST.SOME_TP", line 7
ORA-06512: at line 1
12:02:30 SQL>
Similar Messages
-
How do I Pass a parameter to a SQL Component Task where the source SQL statement is also a variable
Hi,
I have been tasked with making a complex package more generic.
To achieve this I need to pass a parameter to a SQL Component Task where the source SQL statement is also a variable.
So to help articulate my question further I have create a package and database as follows; -
USE [KWPlay]
GO
/****** Object: Table [dbo].[tblTest] Script Date: 05/14/2014 17:08:02 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tblTest](
[ID] [bigint] IDENTITY(1,1) NOT NULL,
[Description] [nvarchar](50) NULL,
CONSTRAINT [PK_tblTest] PRIMARY KEY CLUSTERED
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
I populated this table with a single record.
I unit tested the SQL within SSMS as follows;
SELECT * FROM dbo.tblTest
Result; -
ID
Description
1
Happy
DECLARE @myParam NVARCHAR(100)
SET @myParam = 'Sad'
UPDATE dbo.tblTest SET [Description] = @myParam FROM dbo.tblTest WHERE ID = 1
SELECT * FROM dbo.tblTest
Result; -
ID
Description
1
Sad
Within the package I created two variables as follows; -
Name: strSQL
Scope: Package
Data Type: String
Value: UPDATE dbo.tblTest SET [Description] = @myParam FROM dbo.tblTest WHERE ID = 1
Name: strStatus
Scope: Package
Data Type: String
Value: Happy
I then created a single ‘Execute SQL Task’ component within the control flow as follows; -
However when I run the above package I get the following error; -
SSIS package "Package.dtsx" starting.
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "UPDATE dbo.tblTest SET [Description] = @myParam FR..." failed with the following error:
"Parameter name is unrecognized.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task
Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED.
The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the
errors.
SSIS package "Package.dtsx" finished: Failure.
I also tried; -
Name: strSQL
Scope: Package
Data Type: String
Value: UPDATE dbo.tblTest SET [Description] = ? FROM dbo.tblTest WHERE ID = 1
However I received the error; -
SSIS package "Package.dtsx" starting.
Error: 0xC002F210 at Execute SQL Task, Execute SQL Task: Executing the query "UPDATE dbo.tblTest SET [Description] = ? FROM dbo...." failed with the following error: "Parameter name is unrecognized.". Possible failure reasons: Problems with
the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Task failed: Execute SQL Task
Warning: 0x80019002 at Package: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (1) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches
the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "Package.dtsx" finished: Failure.
Kind Regards,
Kieran.
Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/Tried; -
Name: strSQL
Scope: Package
Data Type: String
Value: UPDATE dbo.tblTest SET [Description] = ? FROM dbo.tblTest WHERE ID = 1
and; -
Result; -
SSIS package "Package.dtsx" starting.
SSIS package "Package.dtsx" finished: Success.
Therefore the answer was to put the parameter number rather than the parameter name under the parameter mapping tab-> parameter name column.
Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/ -
How to pass a parameter into execute sql task and later use it into dataflow task?
i am in a situation, where i have a logging table in which i have a primary key called ETL_log_ID which is an identity column and acts as a foreign key for various fact table and dimension tables which are populated using SSIS packages. Now i wanna use the
ETL_log_ID as a parameter in the execute sql task which populates the log table and pass the same value in the data flow task which populates the facts and dimension. Can you let me know how to pass the parameter in a step by step procedure.
Thanks,
Nikhil
Nikhil,
You can check the following :
http://www.programmersedge.com/post/2013/03/05/ssis-execute-sql-task-mapping-parameters-and-result-sets.aspx
http://stackoverflow.com/questions/7610491/how-to-pass-variable-as-a-parameter-in-execute-sql-task-ssis
Regarding the usage in Dataflow task, Can you elaborate on that a little?
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
How to pass a parameter into a sql expression?
How to pass a report parameter into a sql expression?
Hi Donald,
The functionality of using a parameter in a function is only available in the formula editor and not in SQL Expression. Parameters cannot be passed to the SQL Expression, the main purpose of the SQL Expression is to make use of Database functions to make calculations at the database level but the current functionality of the product only allows you to use Database fields.
There is an article that talks on SQL Expressions and can be useful http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2016184&sliceId=&dialogID=6018612&stateId=1%200%206020316
Regards,
Vinay -
Passing Time Parameter to a SQL Script
I am trying to create an SSIS package that will extract data from a non BPC database to load into BPC. I am calling the package from DM prompting for the time parameter. However, I am having problems passing the parameter to the SQL script. I am using OLEDB Data source task using the SQL command - Using the following scrip where the '?'' is the prompt for the BPC time parameter. Any suggestions on how to resolve would be greatly appreciated.
SELECT
CASE
WHEN LEN(GLAccountNumber)=10
THEN LEFT(GLAccountNumber,6)
ELSE GLAccountNumber
END AS ACCOUNT ,
'F_CLO' AS ACCTDETAIL ,
'ACTUAL' AS CATEGORY ,
RTRIM(CompanyCode) AS COMPANY ,
RTRIM(CompanyDepartment) AS COSTCENTER ,
'FM' AS DATASRC ,
'NON_INTERCO' AS INTERCO ,
'NOMAT' AS MATERIALS ,
'NOPC' AS PROFITCTR ,
'LC' AS RPTCURRENCY ,
CAST(YearNumber AS CHAR(4)) + '.' + MonthAbbreviation AS [TIME] ,
SUM(TransactionAmount) AS SIGNEDDAA
FROM dbo.GLTransactionDimension a WITH (nolock)
JOIN dbo.GLTransactionFacts b WITH (nolock)
ON a.GLTransactionDimensionKey = b.GLTransactionDimensionKey
JOIN dbo.DateDimension c WITH (nolock)
ON b.EntryDateDimensionKey = c.DateDimensionKey
WHERE EntryDateDimensionKey LIKE
CASE
WHEN RIGHT(?,3)='APR' THEN '200904%'
WHEN RIGHT(?,3)='MAY' THEN '200905%'
END
AND RowType = 'T'
GROUP BY CompanyCode ,
DepartmentCode ,
CompanyDepartment ,
GLAccountNumber ,
YearNumber ,
MonthAbbreviation
ORDER BY CompanyCode ,
DepartmentCode ,
GLAccountNumber ,
YearNumber ,
MonthAbbreviationHi Steven,
Use SQL task without parameter
Into DM package into Modify script Build a variable where you will build the entire sql string and of course you will be able to pass also the variable.
After that you will call into Modify scrip something like:
TASK( Yourtask, SQL, "the entire SQL with parameter")
Regards
Sorin -
Parameter value in sql statement (Custom Folder)
Hi ,
I want to formulate a custom folder - consisting of a sql statement , inside of which there is a parameter. Then in Desktop , the users can select a number as the searching criteria and this value will replace the parameter in sql statement , as in the following:
select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA from
select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw from
(SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
FROM EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
WHERE CODE_FARMAKOU = FARMAK_CODE
GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
where rw<=&p
order by SUM_POSOTITA desc The problem is that the use of parameter , whereas in sql*plus is valid, in Discoverer is not....
What can i do in this situation...????
Thanks , a lot
SimonHowever , a peculiar event happens....
whereas the sql statement is:
select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA,RW from
select CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE , SUM_POSOTITA , row_number() over (order by sum_posotita desc) rw from
(SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES ,SUM(POSOTITA) SUM_POSOTITA
FROM EKTELESI_AT_SINT_CLINIC A, MITROO_FARMAKOU B
WHERE CODE_FARMAKOU = FARMAK_CODE
GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
UNION ALL
SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
FROM EKTELESI_AT_SINT_EX_IATR A, MITROO_FARMAKOU B
WHERE CODE_FARMAKOU = FARMAK_CODE
GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
UNION ALL
SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
FROM EKTELESI_AT_SINT_FOREON_MS A, MITROO_FARMAKOU B
WHERE CODE_FARMAKOU = FARMAK_CODE
GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
UNION ALL
SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
FROM EKTELESI_GEN_SINT_KLIN A, MITROO_FARMAKOU B
WHERE CODE_FARMAKOU = FARMAK_CODE
GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS
UNION ALL
SELECT CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, TO_DATE(DATES_EKTELESIS,'DD/MM/RRRR') DATES,SUM(POSOTITA) SUM_POSOTITA
FROM EKTELESI_GEN_SINT_EX_IATR A, MITROO_FARMAKOU B
WHERE CODE_FARMAKOU = FARMAK_CODE
GROUP BY CODE_FARMAKOU,EMP_NAME,PACKTYPE,PACKSIZE, DATES_EKTELESIS))
order by RW ascand produces the results....
CODE_FARMAKOU EMP_NAME PACKTYPE PACKSIZE SUM_POSOTITA RW
1000003279 MOXACEF BT 40(BLIST10X4) 45 1
0000014071 DOPAMINE HYDROCHLORIDE VIAL 5 ML X 25 30 2
1000016655 KABIVEN BT 50ÖÕÓ.×1,7ML 21 3
1000014127 DEPON VIT. C BT 2TUBX10 6 4
0000002419 FACTREL INJECTION VIAL 2 ML 5 5
0000086289 DETUSSIN EXPECTORANT BOT 120 ML 3 6
1000016655 KABIVEN BT 50ÖÕÓ.×1,7ML 2 7
1000014127 DEPON VIT. C BT 2TUBX10 2 8
1000000760 DEPON BT 20(BLIST2X10) 2 9
1000003279 MOXACEF BT 40(BLIST10X4) 1 10
1000003279 MOXACEF BT 40(BLIST10X4) 1 11
1000000760 DEPON BT 20(BLIST2X10) 1 12
12 rows selectedIn Discoverer , even i select to see -as parameter- let's say the 10 first records, the system displays the 7 first records , whereas when i want to see the 1,2,3,4,5,6,7 first records the system works fine....and displays accordingly 1,2,3,4,5,6,7 first records. The problem occurs above the 8th record-as parameter selected..!!!!!
I defined the parameter as :Rw<=:Rw
What may be the problem...????
SORRY!!!!! I FOUND THE PROBLEM ....!!!!
Regards and many thanks,
Simon
Message was edited by:
sgalaxy -
How would you send a date-range parameter to a SQL sproc?
Team,
MY ENVIRONMENT
SQL 2005, Crystal Reports for Visual Studio 2005
MY PROBLEM
I am authoring both a sproc and a report, so I have full control over the design. I am a SQL expert and also a Crystal 8.5 expert.
I have done the Sproc-Report connection dozens of times.
Please consider along with me the sequence of creating a report based on a parameterized stored procedure.
My sproc header is shown here:
CREATE Procedure dbo.usp_DocumentActivityReport(
@Department NVARCHAR(50)
, @DateRange NVARCHAR(50)
) AS
SELECT Col1, Col2, Col3 FROM #TEMP
MY THOUGHT PROCESS
@DEPARTMENT is a string. That's easy.
@DATERANGE is a DATE RANGE and I don't know how to get Crystal Reports to prompt for a date range, so I used a String parameter knowing I can parse a specially formatted string, and knowing that I can use a formula to compute the string.
Step 1. Create the blank report, the {?Department} parameter, the {?CreationDateRange} report parameter, and the {@DateRangeText} conversion formula that converts {?CreationDateRange} to the specially formatted string.
Step 2. Test the stored procedure.
Tests pass; It returns data when I run it with values, with zero-length string values, and with NULL values.
Step 3. Tie the report to the stored procedure.
Adding the sproc directly creates two hard-wired, undeletable parameters, and returns data columns. That's no good because the user must supply the specially formatted string for the date range. So, I try using Add Command instead, with this syntax:
{call "EXP_TEST"."dbo"."usp_CorroDocumentActivityReport" (N'{?Department}', N'{@DateRangeText}')}
This code is accepted, but Add Command did not create any undeletable parameters at all. I guess that's OK.
But the worst part is that it does not show any output columns with data either! AAARGH!
Please assist with showing me the proper order to do these steps.
BTW, here's the VB Syntax formula for {@DateRangeText}:
Dim min As String
dim max as String
if HasLowerBound ({?CreationDateRange}) then
min = ToText(Minimum({?CreationDateRange}),"MM/dd/yyyy")
else
max = ""
end if
if HasUpperBound ({?CreationDateRange}) then
max = ToText(Maximum({?CreationDateRange}),"MM/dd/yyyy")
else
max = ""
end if
if IncludesLowerBound ({?CreationDateRange}) then
min = "[" & min
else
if HasLowerBound ({?CreationDateRange}) then min = "(" & min
end if
if IncludesUpperBound ({?CreationDateRange}) then
max = max & "]"
else
if HasUpperBound ({?CreationDateRange}) then max = max & ")"
end if
'formula = min & "..." & max
formula = "(1/1/2009...3/1/2009)"
sorry ... cross-posted per AmitLudek,
It sounds like you and The specified item was not found. think along the same lines! I have cross-posted for both of you now!
Please see Simple Sproc Parameters question
~ Shaun -
How to capture a parameter value in SQL QUERY of scale marker using GO URL
Hi,
Can any one please tell me how to capture the parameter value from go url inside Where clause of Scale Marker.
I am trying to sift the position of scale marker based on SQL Query.
Thanks-Bhaskar Gouda.
Edited by: 961171 on Sep 25, 2012 12:33 AMSince this is a synchronous interface, where source is a soap(proxy) call and target is JDBC in the first mapping both of them are request scenarios.
Source Structure:
RootNode
Request 1...unbounded
No_of_Days 1.1 String
Target Structure:
RootNode
Statement
TableName
Action mapped to SQL_QUERY
Access - SELECT DISTINCT AL.EC_NO,DP.DATE_TO_FORMAL FROM T_APPLICATION_LIST AL,(SELECT DE.EC_NO AS "EC_NO", DE.PACKAGE_NO AS "PACKAGE_NO",PC.DATE_TO_FORMAL AS "DATE_TO_FORMAL" FROM DAICYO_ECNO DE,PACKAGECTL PC WHERE DE.PACKAGE_NO = PC.PACKAGE_NO AND PC.DATE_TO_FORMAL > (TRUNC(SYSDATE) - to_number('$No_Of_DAYS$'))) DP WHERE AL.EC_NO IN (SELECT EC_NO FROM DAICYO_ECNO WHERE PACKAGE_NO IN (SELECT PACKAGE_NO FROM PACKAGECTL WHERE DATE_TO_FORMAL > (TRUNC(SYSDATE) - to_number('$No_Of_DAYS$')))) AND (AL.FAMILY = '' or '' is null and AL.FAMILY is not null ) and DP.EC_NO = AL.EC_NO ORDER BY DATE_TO_FORMAL
Key
No_Of_Days 1..1 String
In Return I am expecting a JDBC response from the Oracle Database as:
Source Structure:
RootNode
STATEMENT_response 1...unbounded
row 0...undbounded
EC_NO 1..1 String
Target Structure:
RootNode
RESPONSE
row
EC_NO 1..1 String -
How to subsequently change ERROR_ON_OVERLAP_TIME parameter in PL/SQL?
Hi All!
I have a problem considering the ERROR_ON_OVERLAP_TIME session parameter.
I would like to change it from the inside of a PL/SQL block.
It simply works this way:
DECLARE
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET ERROR_ON_OVERLAP_TIME=TRUE';
END;
And that is fine. Try to run the following code subsequently:
set serveroutput on
DECLARE
l_date DATE;
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET ERROR_ON_OVERLAP_TIME=FALSE';
dbms_output.put_line('01 '||sysdate);
l_date:=CAST(from_tz(CAST(TO_DATE('2010.10.31. 02:00:00', 'YYYY.MM.DD. HH24:MI:SS') AS TIMESTAMP), 'Europe/Budapest') AT TIME ZONE 'UTC' AS DATE);
dbms_output.put_line('02 '||sysdate);
EXECUTE IMMEDIATE 'ALTER SESSION SET ERROR_ON_OVERLAP_TIME=TRUE';
dbms_output.put_line('03 '||sysdate);
END;
Once it raises an error as the parameter was set to true, the next time it does not.
This is probably because PL/SQL is not as structured as it is supposed to be.
My guess is that l_date is calculated first, and after it is done, the pl/sql engine starts to evaluate and execute other things such as alter sessions.
So anyone could help me how to solve this problem? I tried several things to overcome this problem (functions, exception branches, etc), but none of them worked.
Any help would be much appriciated. Thanks in advance,
bernyoThe problem still exists. Please take a look at the following example:
Run:
ALTER SESSION SET ERROR_ON_OVERLAP_TIME=FALSE;
At this point the parameter is set to false.Run the followin PL/SQL block:
DECLARE
l_date DATE;
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET ERROR_ON_OVERLAP_TIME=TRUE';
dbms_output.put_line('01 '||sysdate);
l_date:=CAST(from_tz(CAST(TO_DATE('2010.10.31. 02:00:00', 'YYYY.MM.DD. HH24:MI:SS') AS TIMESTAMP), 'Europe/Budapest') AT TIME ZONE 'UTC' AS DATE);
dbms_output.put_line('02 '||sysdate);
EXECUTE IMMEDIATE 'ALTER SESSION SET ERROR_ON_OVERLAP_TIME=FALSE';
dbms_output.put_line('03 '||sysdate);
END;
It does not raise an exception! Why? It should, because the parameter is supposed to be changed by the time the l_date value is assigned, but it is not.
So how should I handle this? It seems to me that this is quite a buggy feature.
Just to see my point check out the following script:
ALTER SESSION SET ERROR_ON_OVERLAP_TIME=TRUE;
SELECT CAST(from_tz(CAST(TO_DATE('2010.10.31. 02:00:00', 'YYYY.MM.DD. HH24:MI:SS') AS TIMESTAMP), 'Europe/Budapest') AT TIME ZONE 'UTC' AS DATE) FROM DUAL;
It raises an exception, as should the PL/SQL block.
Any help is much appriciated.
Thanks,
bernyo -
Pass parameter to pl/sql block
Hi,
I am getting following error when trying to create staging table from shell script by passing parameter.
SQL*Loader-941: Error during describe of table T1_1DAY_STG
ORA-04043: object T1_1DAY_STG does not existThis is PL/SQL block being called inside shell script
begin
execute immediate 'create table t1_&1._stg as select * from t1_rpt_tmt';
end Shell Script Call
load_data_to_oracle()
for i in 1DAY 7DAY 15DAY
do
${ORACLE_HOME}/bin/sqlplus ${ORACLE_USER}/${ORACLE_PASSWD}@${ORACLE_SID} << EOF > ${TMP_LOG_FILE} 2>&1
set serveroutput on
@${CREATE_STAGE_SQL} "$i"
COMMIT;
QUIT;
EOF
########Main#######
load_data_to_oracleThanks
SandyIt is probably a permission issue. Are you the owner of the table you are trying to select from in your PL/SQL block? if not, do you have select permission granted specifically?
Here is my test:
test > create table T_ABC (a number, b number);
Table created.
test > @t_abc Hello
test > begin
2
3 execute immediate 'create table t1_&1._stg as select * from t_abc';
4
5 end;
6 /
old 3: execute immediate 'create table t1_&1._stg as select * from t_abc';
new 3: execute immediate 'create table t1_Hello_stg as select * from t_abc';
PL/SQL procedure successfully completed.
test > desc t1_Hello_stg
Name
A
B
test > desc T_ABC
Name
A
B
test > -
How to pass parameter to pl/sql block
Hi,
I am getting following error when trying to create staging table from shell script by passing parameter.
SQL*Loader-941: Error during describe of table T1_1DAY_STG
ORA-04043: object T1_1DAY_STG does not existThis is PL/SQL block being called inside shell script
begin
execute immediate 'create table t1_&1._stg as select * from t1_rpt_tmt';
endShell Script Call
load_data_to_oracle()
for i in 1DAY 7DAY 15DAY
do
${ORACLE_HOME}/bin/sqlplus ${ORACLE_USER}/${ORACLE_PASSWD}@${ORACLE_SID} << EOF > ${TMP_LOG_FILE} 2>&1
set serveroutput on
@${CREATE_STAGE_SQL} "$i"
COMMIT;
QUIT;
EOF
########Main#######
load_data_to_oraclethanks
sandyi dont understand why you want run it from shell script. you can write procedure like this :
SQL>
SQL> CREATE OR REPLACE PROCEDURE mytestProc(p_in VARCHAR2) AS
2 begin
3 FOR i IN (select REGEXP_SUBSTR(p_in,'[^,]+',1,ROWNUM) tblName
4 from dual
5 CONNECT BY INSTR(p_in, ',', 1, level - 1) > 0)
6 LOOP
7 execute immediate 'create table t1_'||i.tblname||'_stg as select * from myt2';
8 END LOOP;
9 end;
10 /
Procedure createdand run it
SQL> exec mytestProc('1day,7day,15day');
PL/SQL procedure successfully completed
SQL> select * from t1_15day_stg
2 union all
3 select * from t1_1day_stg
4 union all
5 select * from t1_7day_stg;
T N
SQL>
SQL> drop table t1_15day_stg;
Table dropped
SQL> drop table t1_1day_stg;
Table dropped
SQL> drop table t1_7day_stg;
Table dropped
SQL> purge table t1_15day_stg;
Done
SQL> purge table t1_1day_stg;
Done
SQL> purge table t1_7day_stg;
Done
SQL> -
Using/calling a parameter in the SQL Query!
Hi
How do I use or call a parameter from the parameterform in my SQL query in Reports ??
Thanks in advange *S
/Stig :-)If you have user parameters of P_BEGINDATE and P_ENDDATE, in your query you would reference them by the following:
FROM auditlog
WHERE (eventtimestamp between :P_BEGINDATE and :P_ENDDATE
or :P_BEGINDATE IS NULL)
If you are using the report through Oracle Applications Concurrent Manager make sure the Token (when setting up parameters for the concurrent program)matches the user parameter exactly.
- Rob -
Passing int[] parameter to PL/SQL stored proc via SQLJ
This should be easy. I want to pass an array of Java integers i.e. int[] as an IN parameter to a PL/SQL stored procedure that expects a TABLE OF INTEGER.
But SQLJ keeps giving me an error when I try to call the procedure, saying that int[] is an unsupported Java type.
Is this true? Is it really impossible to pass a simple int array into a PL/SQL procedure via SQLJ?
All help will be gratefully received.
ChrisYes, you cannot pass int[], since index-by-tables are not supported by either JDBC or by SQLJ.
(Well, I lied just a little bit: if you use an 8.1.7 or later JDBC-OCI driver, then there is some support for scalar index-by-tables. But not with thin, kprb drivers, or with SQLJ.)
null -
Parameter passing in sql statement
hello..
i want to execute a value insertion query in jdbc..where the values are all parameterized string variables.but it failed to execute the query...
and generating a sql exception "too few parameter.."
but it succesfully executes with a direct string like'hello'....
heres my sample code for this...
public void settablevalue(String pn,String pid,String time)
try
Statement s1=con.createStatement();
System.out.println(pn+" "+pid+" "+time);
char []pname=new char[50];
char []prcsid=new char[50];
char []timecrtn=new char[100];
pname=pn.toCharArray();
prcsid=pid.toCharArray();
timecrtn=time.toCharArray();
s1.execute("insert into ProcessEvent values(pname[],prcsid[],timecrtn[])");
System.out.println("Executed");
s1.close();
catch (Exception err)
System.out.println("ERROR: " + err);
now do i insert string values in the table...
pls help...thnx in advanceYou should use a PreparedStatement. Read the JavaDoc of PreparedStatement.
Usually you prepare a statmenet like this: "insert into ProcessEvent values (?, ?, ?)" and then use setString(), setDate(), ... to set the concrete values.
Additionally ('though this doesn't have to do anything with your problem): You don't need to create char-arrays, and even if you do, you don't have to initialize them (using "char[]pname=new char[50]") if you later assign a new value (using "pname=pn.toCharArray()"). -
Parameter reuse in SQL statement
I'm trying to convert to ODP.NET (version 10.1.0.200) from the Microsoft OracleClient. With the ms client I was able to reuse parameters within the sql statement multiple time. It appears with ODP.NET I can only do this one time with one parameter - after that an ora-01008 is thrown.
For example:
cmd.commandText = "select count(*) from some_table where (dept_no = :deptNo or :deptNo is null) and (emp_no = :empNo or :empNo is null)"
Above would work in ms OracleClient but doesn't appear to in ODP.NET. I am correctly adding the parameters to the command - everything works fine until I add the second occurrence of the second parm...
Has anyone else run into this or found a fix?Never Mind - The default behavior is cmd.BindByName = false. Once I set it to true everything was just wonderful.
Maybe you are looking for
-
Hi I have TFS server installed and working with other SharePoint farm. (TFS installed, SharePoint extension installed and Granted Access for TFS. When Setup TFS - SharePoint Web Application Settings, It ask for the three values: Web Application UR
-
"Content Less" workflows with WebCenter Content
Hi, "BPEL Process Engine" comes along with WebCenter Content for restricted use (for developing workflows/processes within or between WebCenter Content components only). And as per the documentation only Basic (human triggered workflows with a docume
-
Urgent : Barcode Printing porblem in smartforms.
Hi Experts, 1, I am be able to see the barcode in print-preview but while i am taking the print of that smartform it shows the value of that barcode... How to solve this problem? 2, when i am seeing the barcode in print-preview it is showing the blac
-
Message d'erreur lors de l'utilisation de l'outil RT communication wizard
Bonjour, Je développe actuellement une application sur Labview RT 7.0. Voulant créer une interface avec un module sur un PC hôte, j'utilisais l'outil RT communication Wizard. Mais depuis le milieux de semaine, RT Communication wizard affiche un messa
-
"This value would cause one or more object to leave the pasteboard"
I'm getting a little tired of this one. I've inserted a photo into my document, and need to just tweak it over a bit to the right. Less than .5 inch, but I'm not able to move it at all. There's plenty of room on the "page" and I'm not entering any