SQL how to use a variable and use the result as a reference for the name of the table
Hi all
I have new in the declaration of Oracle, sorry in advance if something is easy for you all. BTW, I have this scenario:
I have a table OL structured in this way:
Date - it contains dates, for example 11/01/2015
TableName - it contains strings, for example, OL1, OL2, OL3 and so on...
Then I have a different table, the name of these tables are of the same name in the table of the OL, so I have table table, OL1, OL2, OL3 table and so on. The structure of these tables is the same. And Yes.
table OL1
---------------------------------------------------------------
ID LAST NAME FIRST NAME PHONE
---------------------------------------------------------------
1 JOHN DOE 12345679
2 PAUL 111111122 TIBBS
table OL2
---------------------------------------------------------------
ID LAST NAME FIRST NAME PHONE
---------------------------------------------------------------
1 ANNA KRAIG (NULL)
NATHAN FRESHMANN 111111133 2
If the scenario is clear, I would like to retrieve the value (null), research in all the OL * tables by using the value of the OL table (tablename) max.
If I'm going to do these simple steps, I got the result:
Select max (TableName) OL
the result will be OL2
# I know not how to use the option set to avoid changing the table name in the sql statement all the time.
set mytable = 'OL2.
Select Name, family name
of & mytable
When the phone is null
Any idea?
Thank you very much in advance.
Hello
run immediately "select dt.log_id, obj.presentation_name, dl.begin_time
bulk collect into v_result_set
of ' | v_ol |' dt join internal ol_object obj on
DT.object_type_id = obj.object_type_id
inner join ol_chunk_log dl on
DT.log_id = DL.log_id
where dt.data_value is null';
dbms_output.put_line (v_ol);
end;
Correct the code such as:
run immediately "select dt.log_id, obj.presentation_name, dl.begin_time
of ' | v_ol |' dt join internal ol_object obj on
DT.object_type_id = obj.object_type_id
inner join ol_chunk_log dl on
DT.log_id = DL.log_id
where dt.data_value is null' bulk collect into v_result_set;
for i in v_result_set.first ... v_result_set. Last
loop
dbms_output.put_line ('LOG ID: ' | ) ( v_result_set.log_id (i)) ;
dbms_output.put_line (' NAME CLOSELY: ' |) v_result_set.presentation_name (i));
dbms_output.put_line (' START TIME: ' |) ( v_result_set.begin_time (i)) ;
end loop;
end;
Kind regards.
Tags: Database
Similar Questions
-
How to use the concepts Advanced PL/SQL in oracle reports and forms
Hi all
Can anyone suggest me how to use the Concepts(nested tables,PAA,Varrays,Objects...) Advanced PL/SQL in Oracle forms.
In fact, I created a Table whose column of type Varray. now, I want to create an element in oracle forms on this field. can anyone suggest me how to proceed.
Thank you
KumarHello
Take a look at this one:
http://SheikYerbouti.developpez.com/tutoforms10g/tutoforms10g.htm
especially the chapter on the block that contains a collection of (2.3.3). The sample is built around a nested table, but you get the idea to adapt to work with a varray.Kind regards
AlexIf someone useful or appropriate please mark accordingly.
-
Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.
CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
)
RETURNS INTEGER
AS
-Declaring variables
v_is_true INTEGER.
BEGIN
SELECT
CASE
WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)
THEN 1
ON THE OTHER
0
END
IN
v_is_true
Of
in_schema.in_tablename
;
RETURN v_is_true;
END;
/
When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist
How to use the values of the input variables on the table select statement names?
Hello
Here's a way you can use dynamic SQL statements for this task:
CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE
(
in_schema IN VARCHAR2,
in_tablename IN VARCHAR2,
in_datefield IN VARCHAR2,
in_first_date DATE DEFAULT SYSDATE - 1,.
in_last_date DATE by DEFAULT NULL
)
RETURNS INTEGER
AS
-IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield
-contains all the dates in the in_first_date of the range through included in_last_date
- and it returns 0 if there is no such lines.
-If in_last_date is omitted, the search only the data on in_first_date.
-If in_first_date is omitted, it defaults to yesterday.
-Time parts of the in_first_date and in_last_date are ignored.
-Declaring variables
sql_txt VARCHAR2 (1000);
v_is_true INTEGER.
BEGIN
sql_txt: = 'SELECT COUNT (*).
|| 'FROM ' | in_schema | '.' || in_tablename
|| 'WHERE ' | in_datefield | ' > =: d1'
|| «AND» | in_datefield | '< > >
|| 'AND ROWNUM = 1';
dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE"); -For debugging
Sql_txt EXECUTE IMMEDIATE
IN v_is_true
With the HELP of TRUNC (in_first_date) - d1
TRUNC (NVL (in_last_date
in_first_date
)
) + 1 -- d2
;
RETURN v_is_true;
END is_ydaydata_to_table;
/
DISPLAY ERRORS
If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above. In this way, you can easily see exactly what will be executed. Comment out the call to dbms_output under test is completed.
Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future. For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days. The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).
-
How to use the global variable in the table target?
Hello
I am trying to load several files into a single interface. the data is loaded successfully. 92. the files are there. for this I used variables and package.
My requrement is 92 files of data loaded into the target table. I want to know what data from file.
to this I added a column (filename) to the existing target table.
If I used joints (not same condition), its totally wrong. all file names are coming.
Please see the following screenshots.
exit; target table.
in fact in the target table. first 10 lines are coming from file.i.e first _ACCOUNT_LIMIT_511.TXT. but all the files names are coming.
I'm confuse. After the first data file inserted then insert second data file. in that all file names are coming. Please help me.
I thought that the global variable is preferable to identify the data came from which file.
to do this, the global variable is used in the target table. I don't always have my exit.
Please help me.
Thanks in advance.
Hello
You can use the same way, how you use the project variable, just you have to do a thin is #GLOBAL.variable_name for example: #GLOBAL. SMART_AL_FILE_NAME_S
Note: Make sure you that while you use one variable overall in interface, indicator should be staged as you chose above the screen
hope this helps you
Kind regards
Phanikanth
-
How to use the capture and the print button
I tried to figure out how to use the capture and the "print" button, or add or what you call. I press it and the whole page of a different color changes, so I try to cut the section I want but I don't know how to send it to the printer. Can someone help me with this. I'm not at savvy with tech stuff, but when I find a recipe or something and it doesn't have an option to print a certain area, I can't understand how to use it?
Thank you
Andi Starbuck
That happens to me is, I click and drag to make a rectangle of yellow selection, and as soon as I raise my finger on the mouse button, the part I've selected is captured as an image, a new tab opens and preview before printing, the image display. I can use the installation of the Page or simply print. But if I close the preview, this temporary image vanishes and I'm back on the page where I started. You see something different?
-
I use Windows 10 and use the Canon SX20 IS. How to use the function of Photo stich?
I use Windows 10 and use the Canon SX20 IS. How to use the function of Photo stich?
Is it possible to get the procedure to use feature stich photo?
Will be Zoombrowser EX for windows 10 wotk?
If any expert can guide me... that will be great.
Hi Sat17,
Thank you for your inquiry.
For Windows 8 and beyond, ZoomBrowser EX has been replaced by EX. ImageBrowser
Your software you will need to updated for Windows 10.
You can access the software for your camera by clicking here. Once on our site, scroll down to "Drivers and downloads", then use the drop down menu to choose "8.1 Windows" or "Windows 8.1 (x 64)".» Your camera software has not been updated for Windows 10, but for Windows 8.1 software will run on your computer.
To update your software, click the [Select] button to the right, then click on "How to download and install" for installation instructions.
-
How to use the automatic configuration wizard and where can I FIND?
How to use the automatic configuration wizard and where can I FIND?
Hi TannySmedt,
To activate the Configuration service automatic wireless so it starts automatically, click the Start button. Select settings , then select Control Panel. If you use Windows XP display, select the performance and Maintenance category, and then select Administrative Tools. If you use Classic view, and then select Administrative Tools. In the left pane, click the Services icon. Click the automatic Wireless Configuration icon in the right pane, and change the box Startup Type to Automatic. This parameter will be defined the service starts automatically at boot time. Then click on the Start button to start the automatic Wireless Configuration service zero wireless and click on the OK button.
The automatic Wireless Configuration can also be started and stopped from a command prompt. To start the automatic Wireless Configuration, run the following command:
net start wzcsvc
To stop the automatic Wireless Configuration, run the following command:
net stop wzcsvc
-
Where are the Solution Center shortcuts, and how to use the (Scans)
A frustration more than Windows 8 to get more than
I have attached my C3180 to my new Windows 8 machine and the software installed. It is running, but I'm a bit lost in the use of the center of Solution that seems different from what I had on XP.
1. the only way I could see to change the destination of a scan, has been to create a new shortcut with the destination I want to use. Is this correct?
2. now that I have a short cut, where is it? When I run a scan from the Solution Center, the analysis proceeds to the default destination, so it must use the default shortcut.
Is it possible to use the start scanning on the home of the solution Center window and make the scan go to my choice of the destination folder?
Quit smoking research
I found how to use the solution Center in Windows 8 here.
-
I am runing vista and do not know how to use the fax machine
I am runing vista and do not know how to use the fax machine
Here's how to set up Windows Fax and Scan: http://windows.microsoft.com/en-us/windows-vista/Set-up-your-computer-to-send-and-receive-faxes. Navigate the reference links on the right for more information on how to send faxes and other information. If you do this on every page you just, you can see all the articles on how to fax and scan and configure the system and solve problems, and many other subjects that may be necessary, useful or informative. After that, you must be an expert on this subject.
Here is a quick and easy way to send a fax in Vista: http://www.ehow.com/how_2029566_send-fax-vista.html.
Unfortunately, the foregoing is available in Business, Enterprise, and Ultimate - not Basic or Home Premium. In the latter, you need a 3rd party program. If this is the case, here are some options:
With the compliments of Bob F. http://www.vistax64.com/vista-print-fax-scan/127986-how-do-i-download-windows-fax-scan.html:
Not available in Vista Home Premium Basic FAX. It is available in complete edition,
Extreme and business.You might want to consider Snappy Fax at a low cost:
http://www.snappysoftware.com/or the free version of BVRP:
http://www.usr.com/BVRP/bvrp.aspor a full BVRP Classic Phone Tools 9: $29.90
http://www.shop.Avanquest.com/USA/PR...S_CPT_homepageLook screen kinda gross but the product Snappy fax
actually, is quite rich in features and works very well. BVRP also works very well,
screen looks a bit better. Other that that, there are minor differences
performance between the two.I hope this helps.
Good luck!
Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.
-
I have a T610 HP Smart Thin Client from scratch and I get zero Smart software to recognize the card chip when connecting. How to use the Smart zero 4.4.0 customer service and HP Profile Editor to activate chip cards. You can configure without the profile HP of the XML editor.
Mike Sieradzki
Hello ski_mike.
Welcome to the HP Forums. I understand that you want to support with your Smart Client zero. However, it is a commercial product. To get assistance, thank you for posting your question on the business Forums HP: HP Enterprise Business Community
Thank you
Mario
-
I use Illustrator CC and sent a file to a colleague who uses CS6 where all the layers become a great layer. How can I send it and preserve the layers?
coledang,
Save a copy, and in the following options choose CS6.
In this way, it should open correctly in CS6, and the original document is unscathed.
You may find that some (new CC) features will not survive the downsaving.
Edit: Hi SRiegel.
-
How to use the selection tool to resize a text box? Before I was able to click on the text box with the selection too in order to resize, but now I click on it and it only gives me 'path' or 'anchor' options.
Ashley,
What about window > show the rectangle enclosing (Ctrl / Cmd + Shift + B to toggle)?
-
How to use the same point of view as read only in the ADF and editable
Hello
How to use the same point of view as read only in the ADF and editable? How can we succeed in TF?
-James
Hello
Steven Davelaar wrote a presentation on this 'building highly reusable Taskflows.
From slide 14, that's where your use case comes into play
Frank
-
I can't find a newer version of adobe flash player for ubuntu 14.04, I tried to use the apt version but it wouldn't work and I don't know how to use the tar.gz files and install, I think the current version to .deb
Hi LF12,.
The latest version of Flash Player for Linux is 11.2.202.400. The current versions of Flash Player are displayed here http://www.adobe.com/software/flash/about/. The versions on the page are updated with each new version.
--
Maria
-
How to use the same services-config for servers the and remote.
My flex project works very well using the bottom but when I download my flash on the server I do not work, all the files and related paths are the same execpt remote is a linux server.
<? XML version = "1.0" encoding = "UTF-8"? >
<>services-config
< services >
< id = 'amfphp-flashremoting-service' service
Class = "Flex.Messaging.services.RemotingService"
messageTypes = "flex.messaging.messages.RemotingMessage' >"
< destination id = "amfphp" >
<>channels
< Ref channel = "my-amfphp" / >
< / channels >
Properties of <>
< source > * < / source >
< / properties >
< / destination >
< / service >
< / services >
<>channels
< channel-definition id = "my-amfphp" class = "mx.messaging.channels.AMFChannel" >
" < endpoint uri = ' http://localhost/domainn.org/AMFPHP/gateway.php "class="flex.messaging.endpoints.AMFEndpoint"/ > "
< / channel-definition >
< / channels >
< / services-config >I think the problem is the line
" < endpoint uri = ' http://localhost/domainn.org/AMFPHP/gateway.php "class="flex.messaging.endpoints.AMFEndpoint"/ > "but I don't know how to use the same services-config for servers the and remote.
I'll back up a bit.
Breakpoint URLS are defined as follows in the services - config.xml:
https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure
The meaning of each of the tokens is clearer when we see them as part of a complete url. If your context root is set to http://localhost , then I have no idea how your application runs in any environment.
If you leave the server.name and server.port chips in your configuration file, then they will be replaced when executing according to the location from which your application is served. However, the context.root token is replaced at the time of the compilation based on the value that you specify in Flex Builder or when calling mxmlc.
In order to reuse your file services - config.xml, you must use the same context-root on your development environment and to your deployment environment.
Maybe you are looking for
-
Satellite M30 is not unbootable HARD drive and I can find no error
When I start the laptop, I get only a black screen (after the Toshiba/Bios screen) and a flashing cursor. Nothing else happens. I didn't like the change of configuration, updates etc. before that happened.I am able to start the computer from the CD (
-
What are some recommendations for software for business presentations?
What are some recommendations for applications software for business presentations? I want to organize slides (with visuals and language). I would also like to be able to create folders of files. I searched and have not found any. Thanks in advance f
-
Hello My HP Officejet Pro 8500 printer all-in-One (A910a) almost does print in black color more and some colors have a few lines. You can view the Diagnostic Self Test Pages I printed here.
-
G ' Day, for those who can remember me, I had a problem with a battery 12 cells turns not entirely reboot 10 more hours and only lasting a few hours on a balanced system. I had the Board checked - ok, the company charge to replace the battery. Howeve
-
Is it possible to continuously send sensor nodes to the field device and monitor the response of the probe to check if a package is missed? I want to program the NOR-FBUS configurator to send PNs programmatically.